HomeAccounting

Форк
0
98 строк · 2.5 Кб
1

2
/**
3
 * First we will load all of this project's JavaScript dependencies which
4
 * includes Vue and other libraries. It is a great starting point when
5
 * building robust, powerful web applications using Vue and Laravel.
6
 */
7

8
require('./bootstrap');
9

10
window.Vue = require('vue');
11

12
/**
13
 * Next, we will create a fresh Vue application instance and attach it to
14
 * the page. Then, you may begin adding components to this application
15
 * or customize the JavaScript scaffolding to fit your unique needs.
16
 */
17

18
import Vuex from 'vuex'
19
import Vuetify from 'vuetify';
20
import VSwipe from 'vswipe';
21

22

23
Vue.use(Vuex);
24
Vue.use(Vuetify);
25
Vue.use(VSwipe);
26

27
import privateArea from './components/PrivateArea/PrivateArea.vue';
28

29
/**
30
 * Mobile detected
31
 * @type {MobileDetect}
32
 */
33
let MobileDetect = require('mobile-detect');
34
let md = new MobileDetect(window.navigator.userAgent);
35

36
const mobile = md.mobile();
37

38
const store = new Vuex.Store({
39
    state: {
40
        preloader: false,
41

42
        mobile: mobile,
43

44
        alertControl: {
45
            show: false,
46
            type: 'success',
47
            message: '',
48
        },
49
        defaultCurrency: 643,
50
    },
51
    mutations: {
52
        setPreloader(state, status=true) {
53

54
            if(status === false) {
55
                setTimeout(() => {
56
                    state.preloader = status;
57
                }, 1000)
58
            }
59
            else {
60
                state.preloader = status;
61
            }
62

63
        },
64
        setAlert(state, object) {
65
            state.alertControl.type = object.type;
66
            state.alertControl.show = object.status;
67
            state.alertControl.message = object.message;
68
        },
69
        AlertError(state, error) {
70
            state.alertControl.type = 'error';
71
            state.alertControl.show = true;
72
            state.alertControl.message = 'Ошибка передачи транзакции, попробуйте перезапустить страницу. Ответ сервера: '+error;
73
        },
74
        setDefaultCurrency(state, currencyCode) {
75
            state.defaultCurrency = currencyCode;
76
        }
77
    },
78
    getters: {
79
        getPreloader: state=> {
80
            return state.preloader;
81
        },
82
        getAlert: state => {
83
            return state.alertControl;
84
        },
85
        mobile: state => {
86
            return state.mobile;
87
        },
88
        getDefaultCurrency: state => {
89
            return state.defaultCurrency;
90
        }
91
    },
92
});
93

94
const app = new Vue({
95
    el: '#privateArea',
96
    template: '<private-area></private-area>',
97
    components: {privateArea},
98
    store
99
});
100

Использование cookies

Мы используем файлы cookie в соответствии с Политикой конфиденциальности и Политикой использования cookies.

Нажимая кнопку «Принимаю», Вы даете АО «СберТех» согласие на обработку Ваших персональных данных в целях совершенствования нашего веб-сайта и Сервиса GitVerse, а также повышения удобства их использования.

Запретить использование cookies Вы можете самостоятельно в настройках Вашего браузера.