share routes refactoring

This commit is contained in:
Čarodej
2022-05-13 11:40:39 +02:00
parent c0e431b384
commit 69a48e8925
35 changed files with 267 additions and 145 deletions
+1 -1
View File
@@ -105,7 +105,7 @@ const actions = {
// Get route
let route = {
RequestUpload: `/api/file-request/${router.currentRoute.params.token}/navigation`,
Public: `/api/browse/navigation/${router.currentRoute.params.token}`,
Public: `/api/sharing/navigation/${router.currentRoute.params.token}`,
}[router.currentRoute.name] || '/api/browse/navigation'
axios
+7 -7
View File
@@ -34,7 +34,7 @@ const actions = {
// Get route
let route = getters.sharedDetail
? `/api/zip/${router.currentRoute.params.token}?items=${files.join(',')}`
? `/api/sharing/zip/${router.currentRoute.params.token}?items=${files.join(',')}`
: `/api/zip?items=${files.join(',')}`
// Download zip
@@ -60,14 +60,14 @@ const actions = {
// Get route
let route = {
RequestUpload: `/api/file-request/${router.currentRoute.params.token}/move`,
Public: `/api/editor/move/${router.currentRoute.params.token}`,
Public: `/api/sharing/move/${router.currentRoute.params.token}`,
}[router.currentRoute.name] || '/api/move'
let moveToId = to_item.data ? to_item.data.id : to_item.id
axios
.post(route, {
to_id: moveToId || null,
to_id: moveToId || undefined,
items: itemsToMove,
})
.then(() => {
@@ -88,7 +88,7 @@ const actions = {
// Get route
let route = {
RequestUpload: `/api/file-request/${router.currentRoute.params.token}/create-folder`,
Public: `/api/editor/create-folder/${router.currentRoute.params.token}`,
Public: `/api/sharing/create-folder/${router.currentRoute.params.token}`,
}[router.currentRoute.name] || '/api/create-folder'
axios
@@ -127,7 +127,7 @@ const actions = {
// Get route
let route = {
RequestUpload: `/api/file-request/${router.currentRoute.params.token}/rename/${data.id}`,
Public: `/api/editor/rename/${data.id}/${router.currentRoute.params.token}`,
Public: `/api/sharing/rename/${data.id}/${router.currentRoute.params.token}`,
}[router.currentRoute.name] || `/api/rename/${data.id}`
axios
@@ -150,7 +150,7 @@ const actions = {
// Get route
let route = {
RequestUpload: `/api/file-request/${router.currentRoute.params.token}/upload/chunks`,
Public: `/api/editor/upload/chunks/${router.currentRoute.params.token}`,
Public: `/api/sharing/upload/chunks/${router.currentRoute.params.token}`,
}[router.currentRoute.name] || '/api/upload/chunks'
// Create cancel token for axios cancellation
@@ -320,7 +320,7 @@ const actions = {
// Get route
let route = {
RequestUpload: `/api/file-request/${router.currentRoute.params.token}/remove`,
Public: `/api/editor/remove/${router.currentRoute.params.token}`,
Public: `/api/sharing/remove/${router.currentRoute.params.token}`,
}[router.currentRoute.name] || '/api/remove'
axios
+2 -2
View File
@@ -25,7 +25,7 @@ const actions = {
return new Promise((resolve, reject) => {
axios
.get(`/api/browse/folders/${id}/${router.currentRoute.params.token}${getters.sorting.URI}`)
.get(`/api/sharing/folders/${id}/${router.currentRoute.params.token}${getters.sorting.URI}`)
.then((response) => {
let folders = response.data.folders.data
let files = response.data.files.data
@@ -50,7 +50,7 @@ const actions = {
getShareDetail: ({ commit, state }, token) => {
return new Promise((resolve, reject) => {
axios
.get(`/api/browse/share/${token}`)
.get(`/api/sharing/share/${token}`)
.then((response) => {
resolve(response)