diff --git a/Services/client/src/components/FileItem.vue b/Services/client/src/components/FileItem.vue index d0e9325..0378203 100644 --- a/Services/client/src/components/FileItem.vue +++ b/Services/client/src/components/FileItem.vue @@ -394,7 +394,7 @@ async function submitFileForm( @confirm=" () => deleteFormType && - (deleteFolder(deleteFormPath), deleteFile(deleteFormPath)) + { deleteFolder, deleteFile }[deleteFormType](deleteFormPath) " /> diff --git a/Services/client/src/stores/tree-data.ts b/Services/client/src/stores/tree-data.ts index 635a4c5..ba0f8ea 100644 --- a/Services/client/src/stores/tree-data.ts +++ b/Services/client/src/stores/tree-data.ts @@ -40,6 +40,8 @@ export interface TreeDataFolder { export const useTreeDataStore = defineStore('changeCabinet', () => { const loader = useLoader() + const indexToRemove = ref() + const fileNameRemove = ref('') const data = ref([]) const currentFolder = ref([]) @@ -94,7 +96,7 @@ export const useTreeDataStore = defineStore('changeCabinet', () => { currentPath.value = pathname const res = await axiosClient.get( - `${apiEndpoint}${requestPath}`, + `${apiEndpoint}${requestPath}` ) const list = res.data.map((v) => ({ @@ -154,6 +156,7 @@ export const useTreeDataStore = defineStore('changeCabinet', () => { const res = await axiosClient.get(`${apiEndpoint}${requestPath}`) currentFile.value = res.data + listDataFile.value = currentFile.value return loader.hide() @@ -245,7 +248,7 @@ export const useTreeDataStore = defineStore('changeCabinet', () => { description: string keyword: string category: string - }, + } ) { loader.show() @@ -265,7 +268,7 @@ export const useTreeDataStore = defineStore('changeCabinet', () => { { file: file.name, ...metadata, - }, + } ) if (res && res.data.upload) { @@ -294,7 +297,7 @@ export const useTreeDataStore = defineStore('changeCabinet', () => { keyword: string category: string }, - file?: File, + file?: File ) { loader.show() @@ -309,7 +312,7 @@ export const useTreeDataStore = defineStore('changeCabinet', () => { const res = await axiosClient.patch<{ upload: string }>( `${apiEndpoint}${requestPath}`, - { file: file?.name, ...metadata }, + { file: file?.name, ...metadata } ) if (res && res.data.upload) { @@ -342,7 +345,6 @@ export const useTreeDataStore = defineStore('changeCabinet', () => { if (pathArray.length >= 5) requestPath += `/subfolder/${pathArray[3]}` requestPath += `/file/${pathArray.at(-1)}` - console.log(requestPath, pathArray) await axiosClient.delete(`${apiEndpoint}${requestPath}`) if (currentDept.value === 0) { @@ -351,6 +353,8 @@ export const useTreeDataStore = defineStore('changeCabinet', () => { await getFile(currentPath.value) + currentFile.value = currentFile.value.filter((v) => v.pathname !== pathname) + return loader.hide() }