feat: 大部分注册登录功能

Co-authored-by: Copilot <copilot@github.com>
This commit is contained in:
2026-04-24 18:02:42 +08:00
parent 5ab74ad9dd
commit 5294528148
23 changed files with 858 additions and 167 deletions
+27
View File
@@ -0,0 +1,27 @@
/** 获取错误消息 */
export const getErrorMessage = (error: unknown, fallbackMessage: string) => {
const fetchError = error as {
data?: unknown;
message?: string;
response?: {
_data?: unknown;
};
};
const errorData = fetchError.data ?? fetchError.response?._data;
if (typeof errorData === "string") {
return errorData;
}
if (
errorData &&
typeof errorData === "object" &&
"msg" in errorData &&
typeof errorData.msg === "string"
) {
return errorData.msg;
}
return fetchError.message || fallbackMessage;
};