misc_pterodactyl-panel/resources/assets/scripts/app.js

55 lines
1.6 KiB
JavaScript
Raw Normal View History

import Vue from 'vue';
2018-03-31 21:33:10 +00:00
import Vuex from 'vuex';
import vuexI18n from 'vuex-i18n';
import VuexFlash from 'vuex-flash';
import { createFlashStore } from 'vuex-flash';
import VueRouter from 'vue-router';
2018-03-31 21:33:10 +00:00
// Helpers
import { Ziggy } from './helpers/ziggy';
import Locales from './../../../resources/lang/locales';
// Base Vuejs Templates
import Login from './components/auth/Login';
import ResetPassword from './components/auth/ResetPassword';
2018-03-31 21:33:10 +00:00
// Used for the route() helper.
window.Ziggy = Ziggy;
2018-03-31 21:33:10 +00:00
Vue.use(Vuex);
2018-04-08 21:00:52 +00:00
const store = new Vuex.Store({ plugins: [createFlashStore()] });
const route = require('./../../../vendor/tightenco/ziggy/src/js/route').default;
Vue.config.productionTip = false;
2018-04-08 21:00:52 +00:00
Vue.mixin({ methods: { route } });
Vue.use(VueRouter);
2018-03-31 21:33:10 +00:00
Vue.use(vuexI18n.plugin, store);
2018-04-08 21:00:52 +00:00
Vue.use(VuexFlash, { mixin: true, template: require('./components/errors/Flash.template') });
2018-03-31 21:33:10 +00:00
Vue.i18n.add('en', Locales.en);
Vue.i18n.set('en');
const router = new VueRouter({
2018-04-08 20:46:32 +00:00
mode: 'history',
routes: [
2018-04-08 21:00:52 +00:00
{ name: 'login', path: '/auth/login', component: Login },
{ name: 'forgot-password', path: '/auth/password', component: Login },
{ name: 'checkpoint', path: '/checkpoint', component: Login },
{
name: 'reset-password',
2018-04-08 20:46:32 +00:00
path: '/auth/password/reset/:token',
component: ResetPassword,
props: function (route) {
2018-04-08 21:00:52 +00:00
return { token: route.params.token, email: route.query.email || '' };
}
},
{ path: '*', redirect: '/auth/login' }
]
});
2018-03-31 21:33:10 +00:00
require('./bootstrap');
2018-04-08 21:00:52 +00:00
const app = new Vue({ store, router }).$mount('#pterodactyl');