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

View File

@@ -106,7 +106,7 @@ export default {
// Get route
let route = {
RequestUpload: `/api/file-request/${this.$router.currentRoute.params.token}/upload/remote`,
Public: `/api/editor/upload/remote/${this.$router.currentRoute.params.token}`,
Public: `/api/sharing/upload/remote/${this.$router.currentRoute.params.token}`,
}[this.$router.currentRoute.name] || '/api/upload/remote'
let parentId = this.$store.getters.currentFolder

View File

@@ -890,7 +890,7 @@ export default {
// Get route
let route = this.$store.getters.sharedDetail
? `/api/search/${this.$router.currentRoute.params.token}`
? `/api/sharing/search/${this.$router.currentRoute.params.token}`
: '/api/search'
axios

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

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

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)

View File

@@ -78,7 +78,7 @@ export default {
// Send request to get verify account
axios
.post('/api/browse/authenticate/' + this.$route.params.token, {
.post('/api/sharing/authenticate/' + this.$route.params.token, {
password: this.password,
})
.then((response) => {

View File

@@ -108,7 +108,7 @@ export default {
},
mounted() {
axios
.get(`/api/browse/file/${this.$router.currentRoute.params.token}`)
.get(`/api/sharing/file/${this.$router.currentRoute.params.token}`)
.then((response) => {
this.file = response.data
})