index.js
2.88 KB
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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
import axios from 'axios';
const instance = axios.create({
baseURL: process.env.VUE_APP_API_URL,
});
function registerUser(userData) {
// const url = 'http://localhost:3000/api/signup'
return axios.post('/api/RegistUser', userData);
}
function loginUser(userData) {
// const url = 'http://localhost:3000/api/login'
return axios.post('/api/login', userData);
}
function folder(curData) {
return axios.get('/api/folder/show', {
params: {
id: curData.id,
folder_id: curData.folder_id,
},
});
}
function makeFolder(folderData) {
return axios.post('/api/folder/makefolder', folderData);
}
function deleteFolder(folderData) {
return axios.post('/api/folder/delfolder', folderData);
}
function moveFolder(folderData) {
return axios.post('/api/folder/move', folderData);
}
function file(curData) {
return axios.get('/api/file', {
params: {
id: curData.id,
cur: curData.cur,
},
});
}
function uploadFile(fileData) {
return axios.post('/api/file/upload', fileData, {
headers: {
'Content-Type': 'multipart/form-data',
},
});
}
function detailFile(fileData) {
return axios.get(`/api/file/${fileData.fileName}`, {
params: {
id: fileData.id,
cur: fileData.cur,
},
});
}
function deleteFile(fileData) {
return axios.get(`/api/file/delete/${fileData.fileName}`, {
params: {
//현재 접속한 사람의 id와 삭제할 파일의 이름, 현재 폴더위치를 파라미터로 넘긴다.
id: fileData.user_id,
cur: fileData.cur,
},
});
}
function downloadFile(fileData) {
return axios.get(`/api/file/download/${fileData.fileName}`, {
params: {
//현재 접속한 사람의 id와 다운로드를 위해 선택한 파일의 이름을 파라미터로 넘긴다.
id: fileData.id,
cur: fileData.cur,
},
});
}
function accessedList(curData) {
return axios.get('/api/quick', {
params: {
id: curData.id,
},
});
}
function modifyFile(fileData) {
return axios.post(`/api/file/modify/${fileData.name}`, fileData);
}
function delFavorite(folderData) {
return axios.post('/api/favorites/delfolder', folderData);
}
function addFavorite(folderData) {
return axios.post('/api/favorites/addfolder', folderData);
}
function moveFile(fileData) {
return axios.post('/api/folder/move', fileData);
}
function delFavoriteFile(fileData) {
return axios.post('/api/favorites/delfile', fileData);
}
function addFavoriteFile(fileData) {
return axios.post('/api/favorites/addfile', fileData);
}
function getFavoriteList(userId) {
return axios.get('/api/favorites/show', {
params: {
id: userId,
},
});
}
function shareFile(shareData) {
return axios.post('/api/share', shareData);
}
export {
registerUser,
loginUser,
folder,
makeFolder,
deleteFolder,
moveFolder,
file,
uploadFile,
deleteFile,
downloadFile,
delFavorite,
addFavorite,
moveFile,
delFavoriteFile,
addFavoriteFile,
accessedList,
detailFile,
modifyFile,
getFavoriteList,
shareFile,
};