zhaoyingbo 3f220f7943
All checks were successful
CI Monitor CI/CD / build-image (push) Successful in 29s
CI Monitor CI/CD / deploy (push) Successful in 34s
style: 优化项目结构
2024-07-24 10:35:50 +00:00

20 lines
541 B
TypeScript

import { Gitlab } from "../../types/gitlab";
export const gitlabReqWarp = async <T = any>(
func: Function,
default_value: any
): Promise<T> => {
try {
let response = {} as T & Gitlab.Error;
response = (await func()) as T & Gitlab.Error;
if (response.message === "404 Project Not Found") return default_value;
return response;
} catch {
return default_value;
}
};
export const GITLAB_BASE_URL = "https://git.n.xiaomi.com/api/v4";
export const GITLAB_AUTH_HEADER = { "PRIVATE-TOKEN": "Zd1UASPcMwVox5tNS6ep" };