refactor: clean code

This commit is contained in:
Fu Diwei
2024-12-23 19:31:48 +08:00
parent d509445519
commit 9ef16ebcf9
6 changed files with 21 additions and 9 deletions

View File

@@ -1,3 +1,5 @@
import { ClientResponseError } from "pocketbase";
import { getPocketBase } from "@/repository/pocketbase";
export const run = async (id: string) => {
@@ -13,8 +15,8 @@ export const run = async (id: string) => {
},
});
if (resp.code != 0) {
throw new Error(resp.msg);
if (resp.status != 0 && resp.status !== 200) {
throw new ClientResponseError({ status: resp.status, response: resp, data: {} });
}
return resp;