mirror of
https://gitlab.com/omair-personal/exchange.git
synced 2026-08-19 04:24:08 +00:00
added SPA bootstrap frontend with login, register and admin routes
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
/node_modules
|
||||
/public/hot
|
||||
/public/storage
|
||||
/public/js
|
||||
/public/css
|
||||
/storage/*.key
|
||||
/vendor
|
||||
/.idea
|
||||
|
||||
+2
-2
File diff suppressed because one or more lines are too long
@@ -6,7 +6,6 @@
|
||||
|
||||
<script>
|
||||
export default {
|
||||
middleware: 'auth',
|
||||
middleware: 'admin',
|
||||
|
||||
metaInfo () {
|
||||
|
||||
@@ -21,7 +21,6 @@
|
||||
This is admin
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -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' })
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
<script>
|
||||
export default {
|
||||
middleware: 'auth',
|
||||
middleware: ['auth', 'admin'],
|
||||
|
||||
metaInfo () {
|
||||
return { title: this.$t('home') }
|
||||
|
||||
@@ -36,6 +36,7 @@
|
||||
import { mapGetters } from 'vuex'
|
||||
|
||||
export default {
|
||||
middleware: 'guest',
|
||||
layout: 'basic',
|
||||
|
||||
metaInfo () {
|
||||
|
||||
@@ -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 }
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user