@bagelink/vue 1.8.43 → 1.8.45
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/form/inputs/Upload/upload.d.ts +3 -0
- package/dist/components/form/inputs/Upload/upload.d.ts.map +1 -1
- package/dist/components/form/inputs/index.d.ts +1 -0
- package/dist/components/form/inputs/index.d.ts.map +1 -1
- package/dist/index.cjs +17 -17
- package/dist/index.mjs +4327 -4324
- package/package.json +1 -1
- package/src/components/form/inputs/Upload/upload.ts +13 -8
- package/src/components/form/inputs/index.ts +2 -1
package/package.json
CHANGED
|
@@ -1,26 +1,31 @@
|
|
|
1
|
-
import type { AxiosResponse } from 'axios'
|
|
1
|
+
import type { AxiosInstance, AxiosResponse } from 'axios'
|
|
2
2
|
import type { BglFile, BglFilePatch, UploadOptions } from './upload.types.d.ts'
|
|
3
3
|
import axios from 'axios'
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
let api: AxiosInstance = axios
|
|
6
|
+
|
|
7
|
+
export function createUploadApi(options: { baseURL?: string } = {}) {
|
|
8
|
+
if (options.baseURL !== undefined) {
|
|
9
|
+
api = axios.create({ baseURL: options.baseURL })
|
|
10
|
+
}
|
|
11
|
+
}
|
|
7
12
|
|
|
8
13
|
export const files = {
|
|
9
14
|
get: async (pathKey?: string): Promise<AxiosResponse<BglFile>> => {
|
|
10
|
-
return
|
|
15
|
+
return api.get('/files', { params: { path_key: pathKey } })
|
|
11
16
|
},
|
|
12
17
|
|
|
13
18
|
put: async (
|
|
14
19
|
bglFilePatch: BglFilePatch,
|
|
15
20
|
pathKey?: string
|
|
16
21
|
): Promise<AxiosResponse<BglFile>> => {
|
|
17
|
-
return
|
|
22
|
+
return api.put('/files', bglFilePatch, {
|
|
18
23
|
params: { path_key: pathKey },
|
|
19
24
|
})
|
|
20
25
|
},
|
|
21
26
|
|
|
22
27
|
delete: async (pathKey?: string) => {
|
|
23
|
-
return
|
|
28
|
+
return api.delete(`/files/${pathKey}`, {
|
|
24
29
|
params: { path_key: pathKey },
|
|
25
30
|
})
|
|
26
31
|
},
|
|
@@ -33,7 +38,7 @@ export const files = {
|
|
|
33
38
|
// Backend expects multipart field name "file"
|
|
34
39
|
formData.append('file', file)
|
|
35
40
|
formData.append('upload', file)
|
|
36
|
-
return
|
|
41
|
+
return api.post('/files/upload', formData, {
|
|
37
42
|
headers: { 'Content-Type': 'multipart/form-data' },
|
|
38
43
|
onUploadProgress: options?.onUploadProgress,
|
|
39
44
|
params: { dir_path: options?.dirPath, tags: options?.tags },
|
|
@@ -41,7 +46,7 @@ export const files = {
|
|
|
41
46
|
},
|
|
42
47
|
|
|
43
48
|
list: async (dirPath?: string): Promise<AxiosResponse<BglFile[]>> => {
|
|
44
|
-
return
|
|
49
|
+
return api.get('/files/list', {
|
|
45
50
|
params: { dir_path: dirPath },
|
|
46
51
|
})
|
|
47
52
|
},
|
|
@@ -21,6 +21,7 @@ export { default as TableField } from './TableField.vue'
|
|
|
21
21
|
export { default as TelInput } from './TelInput.vue'
|
|
22
22
|
export { default as TextInput } from './TextInput.vue'
|
|
23
23
|
export { default as ToggleInput } from './ToggleInput.vue'
|
|
24
|
-
export {
|
|
24
|
+
export { createUploadApi } from './Upload/upload'
|
|
25
25
|
|
|
26
|
+
export { default as UploadInput } from './Upload/UploadInput.vue'
|
|
26
27
|
export { useFileUpload } from './Upload/useFileUpload'
|