vue router implemented

This commit is contained in:
carodej
2020-04-07 14:48:29 +02:00
parent bde58fbf60
commit ae4353cc4b
21 changed files with 722 additions and 998 deletions
-5
View File
@@ -1,5 +1,4 @@
const defaultState = {
currentView: 'files',
appSize: undefined,
config: undefined,
}
@@ -10,15 +9,11 @@ const mutations = {
SET_CONFIG(state, config) {
state.config = config
},
SET_CURRENT_VIEW(state, view) {
state.currentView = view
},
SET_APP_WIDTH(state, scale) {
state.appSize = scale
},
}
const getters = {
currentView: state => state.currentView,
appSize: state => state.appSize,
api: state => state.config.api,
config: state => state.config,
+5 -4
View File
@@ -1,6 +1,7 @@
import axios from 'axios'
import {events} from '@/bus'
import i18n from '@/i18n/index.js'
import router from '@/router'
const defaultState = {
fileInfoPanelVisible: localStorage.getItem('file_info_visibility') == 'true' || false,
@@ -22,8 +23,8 @@ const actions = {
events.$emit('show:content')
// Go to files view
if (context.getters.currentView !== 'files') {
context.commit('SET_CURRENT_VIEW', 'files')
if (router.currentRoute.name !== 'Files') {
router.push({name: 'Files'})
}
context.commit('LOADING_STATE', true)
@@ -72,8 +73,8 @@ const actions = {
events.$emit('show:content')
// Go to files view
if (context.getters.currentView !== 'files') {
context.commit('SET_CURRENT_VIEW', 'files')
if (router.currentRoute.name !== 'Files') {
router.push({name: 'Files'})
}
if (! back) context.commit('FLUSH_BROWSER_HISTORY')
+6 -1
View File
@@ -1,11 +1,13 @@
import axios from 'axios'
import {events} from '@/bus'
import i18n from '@/i18n/index.js'
import router from '@/router'
const defaultState = {
authorized: undefined,
app: undefined,
}
const actions = {
getAppData: ({commit, dispatch, getters}) => {
@@ -29,7 +31,8 @@ const actions = {
// Commit Remove Access Token from vuex storage
commit('DESTROY_DATA')
commit('SET_CURRENT_VIEW', 'files')
router.push({name: 'SignIn'})
})
},
addToFavourites: (context, folder) => {
@@ -85,6 +88,7 @@ const actions = {
},
}
const mutations = {
RETRIEVE_APP_DATA(state, app) {
state.app = app
@@ -132,6 +136,7 @@ const mutations = {
})
}
}
const getters = {
isLogged: state => state.authorized,
isGuest: state => ! state.authorized,