mirror of
https://github.com/VueFileManager/vuefilemanager.git
synced 2026-05-20 04:05:01 +00:00
vuefilemanager v1.5-alpha.1
This commit is contained in:
+20
-10
@@ -43,7 +43,9 @@ const actions = {
|
||||
location: folder.deleted_at || folder.location === 'trash' ? 'trash' : 'base'
|
||||
}
|
||||
|
||||
let url = currentFolder.location === 'trash' ? '/folders/' + currentFolder.unique_id + '?trash=true' : '/folders/' + currentFolder.unique_id
|
||||
let url = currentFolder.location === 'trash'
|
||||
? '/folders/' + currentFolder.unique_id + '?trash=true'
|
||||
: '/folders/' + currentFolder.unique_id
|
||||
|
||||
axios
|
||||
.get(context.getters.api + url)
|
||||
@@ -61,12 +63,22 @@ const actions = {
|
||||
if (!init) context.commit('ADD_BROWSER_HISTORY', currentFolder)
|
||||
}
|
||||
})
|
||||
.catch(() => {
|
||||
// Show error message
|
||||
events.$emit('alert:open', {
|
||||
title: i18n.t('popup_error.title'),
|
||||
message: i18n.t('popup_error.message'),
|
||||
})
|
||||
.catch(error => {
|
||||
|
||||
// Redirect if unauthenticated
|
||||
if ([401, 403].includes(error.response.status)) {
|
||||
|
||||
context.commit('SET_AUTHORIZED', false)
|
||||
router.push({name: 'SignIn'})
|
||||
|
||||
} else {
|
||||
|
||||
// Show error message
|
||||
events.$emit('alert:open', {
|
||||
title: i18n.t('popup_error.title'),
|
||||
message: i18n.t('popup_error.message'),
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
getShared: (context, back = false) => {
|
||||
@@ -187,7 +199,7 @@ const actions = {
|
||||
|
||||
if (getters.sharedDetail && getters.sharedDetail.protected)
|
||||
route = '/api/navigation/private'
|
||||
else if (getters.sharedDetail && ! getters.sharedDetail.protected)
|
||||
else if (getters.sharedDetail && !getters.sharedDetail.protected)
|
||||
route = '/api/navigation/public/' + router.currentRoute.params.token
|
||||
else
|
||||
route = '/api/navigation'
|
||||
@@ -209,8 +221,6 @@ const actions = {
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
+3
-2
@@ -3,7 +3,6 @@ import router from '@/router'
|
||||
import {events} from '@/bus'
|
||||
import axios from 'axios'
|
||||
|
||||
|
||||
const actions = {
|
||||
moveItem: ({commit, getters}, [item_from, to_item]) => {
|
||||
|
||||
@@ -86,9 +85,11 @@ const actions = {
|
||||
if (response.data.folder_id == getters.currentFolder.unique_id)
|
||||
commit('ADD_NEW_ITEMS', response.data)
|
||||
|
||||
commit('UPDATE_RECENT_UPLOAD', response.data)
|
||||
commit('UPLOADING_FILE_PROGRESS', 0)
|
||||
|
||||
if (getters.permission === 'master')
|
||||
commit('UPDATE_RECENT_UPLOAD', response.data)
|
||||
|
||||
resolve(response)
|
||||
})
|
||||
.catch(error => {
|
||||
|
||||
+5
-3
@@ -6,12 +6,12 @@ import axios from 'axios'
|
||||
const defaultState = {
|
||||
permissionOptions: [
|
||||
{
|
||||
label: 'Can edit and upload files',
|
||||
label: i18n.t('shared.editor'),
|
||||
value: 'editor',
|
||||
icon: 'user-edit',
|
||||
},
|
||||
{
|
||||
label: 'Can only view and download',
|
||||
label: i18n.t('shared.visitor'),
|
||||
value: 'visitor',
|
||||
icon: 'user',
|
||||
},
|
||||
@@ -74,7 +74,9 @@ const actions = {
|
||||
},
|
||||
getSingleFile: ({commit, state}) => {
|
||||
|
||||
let route = state.sharedDetail.protected ? '/api/files/private' : '/api/files/' + router.currentRoute.params.token + '/public'
|
||||
let route = state.sharedDetail.protected
|
||||
? '/api/files/private'
|
||||
: '/api/files/' + router.currentRoute.params.token + '/public'
|
||||
|
||||
axios.get(route)
|
||||
.then(response => {
|
||||
|
||||
+6
-3
@@ -5,12 +5,12 @@ import router from '@/router'
|
||||
|
||||
const defaultState = {
|
||||
authorized: undefined,
|
||||
permission: 'master', // master | editor | visitor,
|
||||
permission: 'master', // master | editor | visitor
|
||||
app: undefined,
|
||||
}
|
||||
|
||||
const actions = {
|
||||
getAppData: ({commit, dispatch, getters}) => {
|
||||
getAppData: ({commit, getters}) => {
|
||||
|
||||
axios
|
||||
.get(getters.api + '/user')
|
||||
@@ -19,8 +19,11 @@ const actions = {
|
||||
|
||||
}).catch((error) => {
|
||||
|
||||
if (error.response.status == 401) {
|
||||
// Redirect if unauthenticated
|
||||
if ([401, 403].includes(error.response.status)) {
|
||||
|
||||
commit('SET_AUTHORIZED', false)
|
||||
router.push({name: 'SignIn'})
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user