-
Notifications
You must be signed in to change notification settings - Fork 0
/
api.js
98 lines (97 loc) · 3.62 KB
/
api.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
import axios from 'axios'
export default {
getShares: () => {
return axios.get(`${process.env.VUE_APP_TX_SERVER || ''}/api/shares`)
.then(function (response) {
response.currDateTime = new Date().toLocaleString()
return response
})
},
getFileList: (cd, path) => {
if (typeof path === 'undefined') {
path = ''
}
return axios.get(`${process.env.VUE_APP_TX_SERVER || ''}/api/share/${cd}/files/${path}`)
.then(function (response) {
response.currDateTime = new Date().toLocaleString()
return response
})
},
getFile: (url) => {
return axios.get(`${process.env.VUE_APP_TX_SERVER || ''}/api/share/${url}`)
.then(function (response) {
response.currDateTime = new Date().toLocaleString()
return response
})
},
postFile: (cd, path) => {
return axios.post(`${process.env.VUE_APP_TX_SERVER || ''}/api/share/${cd}/file/${path}`)
.then(function (response) {
response.currDateTime = new Date().toLocaleString()
return response
})
},
postFolder: (cd, path) => {
return axios.post(`${process.env.VUE_APP_TX_SERVER || ''}/api/share/${cd}/folder/${path}`)
.then(function (response) {
response.currDateTime = new Date().toLocaleString()
return response
})
},
deleteFile: (cd, path) => {
return axios.delete(`${process.env.VUE_APP_TX_SERVER || ''}/api/share/${cd}/file/${path}`)
.then(function (response) {
response.currDateTime = new Date().toLocaleString()
return response
})
},
deleteFolder: (cd, path) => {
return axios.delete(`${process.env.VUE_APP_TX_SERVER || ''}/api/share/${cd}/folder/${path}`)
.then(function (response) {
response.currDateTime = new Date().toLocaleString()
return response
})
},
moveFile: (cd, path, new_cd, new_path) => {
return axios.post(`${process.env.VUE_APP_TX_SERVER || ''}/api/share/${cd}/move/file/${path}`, {new_path: new_path, new_cd: new_cd})
.then(function (response) {
response.currDateTime = new Date().toLocaleString()
return response
})
},
moveFolder: (cd, path, new_cd, new_path) => {
return axios.post(`${process.env.VUE_APP_TX_SERVER || ''}/api/share/${cd}/move/folder/${path}`, {new_path: new_path, new_cd: new_cd})
.then(function (response) {
response.currDateTime = new Date().toLocaleString()
return response
})
},
renameFile: (cd, path, new_path) => {
return axios.post(`${process.env.VUE_APP_TX_SERVER || ''}/api/share/${cd}/rename/file/${path}`, {new_path: new_path})
.then(function (response) {
response.currDateTime = new Date().toLocaleString()
return response
})
},
renameFolder: (cd, path, new_path) => {
return axios.post(`${process.env.VUE_APP_TX_SERVER || ''}/api/share/${cd}/rename/folder/${path}`, {new_path: new_path})
.then(function (response) {
response.currDateTime = new Date().toLocaleString()
return response
})
},
copyFile: (cd, path, new_cd, new_path) => {
return axios.post(`${process.env.VUE_APP_TX_SERVER || ''}/api/share/${cd}/copy/file/${path}`, {new_path: new_path, new_cd: new_cd})
.then(function (response) {
response.currDateTime = new Date().toLocaleString()
return response
})
},
copyFolder: (cd, path, new_cd, new_path) => {
return axios.post(`${process.env.VUE_APP_TX_SERVER || ''}/api/share/${cd}/copy/folder/${path}`, {new_path: new_path, new_cd: new_cd})
.then(function (response) {
response.currDateTime = new Date().toLocaleString()
return response
})
},
}