mirror of
https://github.com/usual2970/certimate.git
synced 2025-10-04 21:44:54 +00:00
refactor: clean code
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
import { ClientResponseError } from "pocketbase";
|
||||
|
||||
import { getPocketBase } from "@/repository/pocketbase";
|
||||
|
||||
export const notifyTest = async (channel: string) => {
|
||||
@@ -13,8 +15,8 @@ export const notifyTest = async (channel: 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;
|
||||
|
@@ -1,4 +1,6 @@
|
||||
import { Statistics } from "@/domain/statistics";
|
||||
import { ClientResponseError } from "pocketbase";
|
||||
|
||||
import { type Statistics } from "@/domain/statistics";
|
||||
import { getPocketBase } from "@/repository/pocketbase";
|
||||
|
||||
export const get = async () => {
|
||||
@@ -8,8 +10,8 @@ export const get = async () => {
|
||||
method: "GET",
|
||||
});
|
||||
|
||||
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.data as Statistics;
|
||||
|
@@ -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;
|
||||
|
@@ -17,6 +17,9 @@ i18n
|
||||
backend: {
|
||||
loadPath: "/locales/{{lng}}.json",
|
||||
},
|
||||
detection: {
|
||||
lookupLocalStorage: "certimate-ui-lang",
|
||||
},
|
||||
});
|
||||
|
||||
export const localeNames = {
|
||||
|
Reference in New Issue
Block a user