added SPA bootstrap frontend with login, register and admin routes

This commit is contained in:
jack
2018-05-07 19:13:38 +08:00
parent 8da0cbceec
commit 4278419aaa
9 changed files with 15 additions and 8 deletions
+2
View File
@@ -1,6 +1,8 @@
/node_modules
/public/hot
/public/storage
/public/js
/public/css
/storage/*.key
/vendor
/.idea
+2 -2
View File
File diff suppressed because one or more lines are too long
-1
View File
@@ -6,7 +6,6 @@
<script>
export default {
middleware: 'auth',
middleware: 'admin',
metaInfo () {
@@ -21,7 +21,6 @@
This is admin
</div>
</div>
</div>
</template>
+3
View File
@@ -90,6 +90,9 @@ export default {
await this.$store.dispatch('auth/fetchUser')
// Redirect home.
if(store.getters['auth/user'].role === 'admin'){
this.$router.push({ name: 'admin.home' })
}
this.$router.push({ name: 'home' })
}
}
@@ -95,6 +95,9 @@ export default {
await this.$store.dispatch('auth/updateUser', { user: data })
// Redirect home.
if(store.getters['auth/user'].role === 'admin'){
this.$router.push({ name: 'admin.home' })
}
this.$router.push({ name: 'home' })
}
}
+1 -1
View File
@@ -6,7 +6,7 @@
<script>
export default {
middleware: 'auth',
middleware: ['auth', 'admin'],
metaInfo () {
return { title: this.$t('home') }
+1
View File
@@ -36,6 +36,7 @@
import { mapGetters } from 'vuex'
export default {
middleware: 'guest',
layout: 'basic',
metaInfo () {
+3 -3
View File
@@ -10,7 +10,7 @@ const Settings = () => import('~/pages/settings/index').then(m => m.default || m
const SettingsProfile = () => import('~/pages/settings/profile').then(m => m.default || m)
const SettingsPassword = () => import('~/pages/settings/password').then(m => m.default || m)
const Admin = () => import('~/pages/admin/home').then(m => m.default || m)
const AdminHome = () => import('~/pages/admin/home').then(m => m.default || m)
export default [
{ path: '/', name: 'welcome', component: Welcome },
@@ -28,8 +28,8 @@ export default [
{ path: 'profile', name: 'settings.profile', component: SettingsProfile },
{ path: 'password', name: 'settings.password', component: SettingsPassword }
] },
{ path: '/admin', name: 'admin.home', component: Admin },
{ path: '/admin', name: 'admin.home', component: AdminHome },
{ path: '*', component: NotFound }
]