Fix deleteFile undefined $toast and reversed delete/fetch order

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-06 08:09:37 +08:00
parent 6178f09cfe
commit 833427b224
2 changed files with 24 additions and 5 deletions

View File

@@ -256,7 +256,8 @@ export default defineStore('filesStore', {
let api;
if(id == null || isNaN(id)) {
return $toast.default('Delete File API Error.', {position: 'bottom'});
console.error('Delete File API Error: invalid id');
return;
};
const loading = loadingStore();
loading.isLoading = true;
@@ -275,8 +276,8 @@ export default defineStore('filesStore', {
break;
}
try {
await this.fetchAllFiles();
await axios.delete(api);
await this.fetchAllFiles();
await deleteSuccess();
} catch(error) {
apiError(error, 'Failed to delete.');