From d9b8419ac9343a6c7545ec0182e4bc300926b288 Mon Sep 17 00:00:00 2001 From: Bubka <858858+Bubka@users.noreply.github.com> Date: Thu, 16 Jan 2020 13:50:53 +0100 Subject: [PATCH] Reorganize resources/js folder --- resources/js/app.js | 34 ++-------------------- resources/js/{views => components}/App.vue | 0 resources/js/packages/axios.js | 2 ++ resources/js/routes/routes.js | 34 ++++++++++++++++++++++ 4 files changed, 38 insertions(+), 32 deletions(-) rename resources/js/{views => components}/App.vue (100%) create mode 100644 resources/js/routes/routes.js diff --git a/resources/js/app.js b/resources/js/app.js index 701e444f..f3f3477e 100644 --- a/resources/js/app.js +++ b/resources/js/app.js @@ -1,42 +1,12 @@ import Vue from 'vue' -import VueRouter from 'vue-router' +import router from './routes/routes' import axios from './packages/axios' import i18n from './packages/i18n' import FontAwesome from './packages/fontawesome' - -import App from './views/App' -import Accounts from './views/Accounts' -import Create from './views/twofaccounts/Create' -import Edit from './views/twofaccounts/Edit' -import Login from './views/auth/Login' -import Register from './views/auth/Register' -import PasswordRequest from './views/auth/password/Request' -import PasswordReset from './views/auth/password/Reset' -import NotFound from './views/Error' +import App from './components/App' import './components' -Vue.use(VueRouter) - -const router = new VueRouter({ - mode: 'history', - routes: [ - { path: '/', name: 'accounts', component: Accounts, props: true }, - { path: '/login', name: 'login',component: Login }, - { path: '/register', name: 'register',component: Register }, - { path: '/create', name: 'create',component: Create }, - { path: '/edit/:twofaccountId', name: 'edit',component: Edit }, - - { path: '/password/request', name: 'password.request', component: PasswordRequest }, - { path: '/password/reset/:token', name: 'password.reset', component: PasswordReset }, - - { path: '/flooded', name: 'flooded',component: NotFound,props: true }, - { path: '/error', name: 'genericError',component: NotFound,props: true }, - { path: '/404', name: '404',component: NotFound,props: true }, - { path: '*', redirect: { name: '404' } } - ], -}); - const app = new Vue({ el: '#app', components: { App }, diff --git a/resources/js/views/App.vue b/resources/js/components/App.vue similarity index 100% rename from resources/js/views/App.vue rename to resources/js/components/App.vue diff --git a/resources/js/packages/axios.js b/resources/js/packages/axios.js index 2d329ae7..2c925b97 100644 --- a/resources/js/packages/axios.js +++ b/resources/js/packages/axios.js @@ -1,3 +1,5 @@ +import Vue from 'vue' +import router from '../routes/routes' axios.interceptors.request.use(request => { diff --git a/resources/js/routes/routes.js b/resources/js/routes/routes.js new file mode 100644 index 00000000..fab94b19 --- /dev/null +++ b/resources/js/routes/routes.js @@ -0,0 +1,34 @@ +import Vue from 'vue' +import Router from 'vue-router' + +Vue.use(Router) + +import Accounts from '../views/Accounts' +import Create from '../views/twofaccounts/Create' +import Edit from '../views/twofaccounts/Edit' +import Login from '../views/auth/Login' +import Register from '../views/auth/Register' +import PasswordRequest from '../views/auth/password/Request' +import PasswordReset from '../views/auth/password/Reset' +import NotFound from '../views/Error' + +const router = new Router({ + mode: 'history', + routes: [ + { path: '/', name: 'accounts', component: Accounts, props: true }, + { path: '/login', name: 'login',component: Login }, + { path: '/register', name: 'register',component: Register }, + { path: '/create', name: 'create',component: Create }, + { path: '/edit/:twofaccountId', name: 'edit',component: Edit }, + + { path: '/password/request', name: 'password.request', component: PasswordRequest }, + { path: '/password/reset/:token', name: 'password.reset', component: PasswordReset }, + + { path: '/flooded', name: 'flooded',component: NotFound,props: true }, + { path: '/error', name: 'genericError',component: NotFound,props: true }, + { path: '/404', name: '404',component: NotFound,props: true }, + { path: '*', redirect: { name: '404' } } + ], +}); + +export default router \ No newline at end of file