mirror of
https://github.com/usual2970/certimate.git
synced 2025-06-09 14:09:52 +00:00
refactor: clean code
This commit is contained in:
parent
d509445519
commit
9ef16ebcf9
3
go.sum
3
go.sum
@ -392,6 +392,7 @@ github.com/gojek/heimdall/v7 v7.0.3/go.mod h1:Z43HtMid7ysSjmsedPTXAki6jcdcNVnjn5
|
||||
github.com/gojek/valkyrie v0.0.0-20180215180059-6aee720afcdf h1:5xRGbUdOmZKoDXkGx5evVLehuCMpuO1hl701bEQqXOM=
|
||||
github.com/gojek/valkyrie v0.0.0-20180215180059-6aee720afcdf/go.mod h1:QzhUKaYKJmcbTnCYCAVQrroCOY7vOOI8cSQ4NbuhYf0=
|
||||
github.com/goji/httpauth v0.0.0-20160601135302-2da839ab0f4d/go.mod h1:nnjvkQ9ptGaCkuDUx6wNykzzlUixGxvkme+H/lnzb+A=
|
||||
github.com/golang-jwt/jwt v3.2.2+incompatible h1:IfV12K8xAKAnZqdXVzCZ+TOjboZ2keLg81eXfW3O+oY=
|
||||
github.com/golang-jwt/jwt/v4 v4.0.0/go.mod h1:/xlHOz8bRuivTWchD4jCa+NbatV+wEUSzwAxVc6locg=
|
||||
github.com/golang-jwt/jwt/v4 v4.5.1 h1:JdqV9zKUdtaa9gdPlywC3aeoEsR681PlKC+4F5gQgeo=
|
||||
github.com/golang-jwt/jwt/v4 v4.5.1/go.mod h1:m21LjoU+eqJr34lmDMbreY2eSTRJ1cv77w39/MY0Ch0=
|
||||
@ -697,6 +698,8 @@ github.com/pocketbase/dbx v1.11.0 h1:LpZezioMfT3K4tLrqA55wWFw1EtH1pM4tzSVa7kgszU
|
||||
github.com/pocketbase/dbx v1.11.0/go.mod h1:xXRCIAKTHMgUCyCKZm55pUOdvFziJjQfXaWKhu2vhMs=
|
||||
github.com/pocketbase/pocketbase v0.22.21 h1:DGPCxn6co8VuTV0mton4NFO/ON49XiFMszRr+Mysy48=
|
||||
github.com/pocketbase/pocketbase v0.22.21/go.mod h1:Cw5E4uoGhKItBIE2lJL3NfmiUr9Syk2xaNJ2G7Dssow=
|
||||
github.com/pocketbase/pocketbase v0.23.12 h1:HB4THFbzaliF0C3wvpx+kNOZxIwCEMDqN3/17gn5N7E=
|
||||
github.com/pocketbase/pocketbase v0.23.12/go.mod h1:OcFJNMO0Vzt3f9+lweMbup6iL7V13ckxu1pdEY6FeM0=
|
||||
github.com/posener/complete v1.1.1/go.mod h1:em0nMJCgc9GFtwrmVmEMR/ZL6WyhyjMBndrE9hABlRI=
|
||||
github.com/posener/complete v1.2.3/go.mod h1:WZIdtGGp+qx0sLrYKtIRAruyNpv6hFCicSgv7Sy7s/s=
|
||||
github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw=
|
||||
|
@ -7,10 +7,10 @@ import (
|
||||
"github.com/pocketbase/pocketbase/tools/cron"
|
||||
)
|
||||
|
||||
var schedulerOnce sync.Once
|
||||
|
||||
var scheduler *cron.Cron
|
||||
|
||||
var schedulerOnce sync.Once
|
||||
|
||||
func GetScheduler() *cron.Cron {
|
||||
schedulerOnce.Do(func() {
|
||||
scheduler = cron.New()
|
@ -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 = {
|
||||
|
Loading…
x
Reference in New Issue
Block a user