Skip to content

Let's use AI to Earn!

fix: 类型修改、请求器冗余代码删除

gaoSir672d4d18b2a8
diff --git a/@types/i18next.d.ts b/@types/i18next.d.ts
index a873dec9..4ae27cf1 100644
--- a/@types/i18next.d.ts
+++ b/@types/i18next.d.ts
@@ -3,7 +3,7 @@ import Resources from "./resources";
declare module "i18next" {
interface CustomTypeOptions {
- // defaultNS: 'translation'
+ defaultNS: "translation";
resources: Resources;
}
diff --git a/@types/resources.d.ts b/@types/resources.d.ts
index a1b733dc..e8a3ed8a 100644
--- a/@types/resources.d.ts
+++ b/@types/resources.d.ts
@@ -1,46 +1,83 @@
interface Resources {
+ common: {
+ profile: "个人中心";
+ logout: "退出登录";
+ unknownUser: "未知用户";
+ login: "登录";
+ };
demo: {
demoText: "测试文字";
title: "测试页面标题";
};
+ "hot-content": {
+ all: "全部";
+ loading: "加载中...";
+ noData: "暂无数据";
+ rank: "排名";
+ cover: "封面";
+ title: "标题";
+ author: "作者";
+ category: "分类";
+ likes: "点赞";
+ shares: "分享";
+ comments: "评论数";
+ collections: "收藏数";
+ publishTime: "发布于";
+ fans: "粉丝";
+ viewMore: "查看更多";
+ timeRange: "时间范围";
+ filter: "筛选";
+ hotTopics: "热门专题";
+ viralTitles: "爆款标题";
+ topics: "专题";
+ engagement: "互动量";
+ rising: "热";
+ noHotTopics: "暂无热点数据";
+ noViralTitles: "暂无爆款标题数据";
+ noTopicData: "暂无专题数据";
+ total: "共";
+ items: "条";
+ video: "视频";
+ noImage: "暂无图片";
+ platform: "平台";
+ hotEvents: "热点事件";
+ hotContent: "热点内容";
+ };
+ login: {
+ welcomeBack: "哎呦赚";
+ emailPlaceholder: "邮箱";
+ passwordPlaceholder: "密码";
+ login: "登录";
+ or: "或";
+ forgotPassword: "忘记密码?";
+ completeRegistration: "完成注册";
+ setPassword: "设置密码";
+ passwordRequired: "请输入密码";
+ passwordMinLength: "密码长度不能小于6位";
+ enterPassword: "请输入密码";
+ inviteCode: "邀请码(选填)";
+ enterInviteCode: "请输入邀请码";
+ waitingForActivation: "等待激活中...";
+ loginSuccess: "登录成功";
+ loginFailed: "登录失败";
+ loginError: "登录失败,请稍后重试";
+ activationEmailSent: "激活链接已发送至邮箱,请查收并点击激活";
+ registerSuccess: "注册成功,已自动登录";
+ checkStatusError: "检查注册状态失败";
+ registerError: "注册失败,请稍后重试";
+ googleLoginFailed: "Google 登录失败";
+ };
+ route: {
+ home: "首页";
+ accounts: "账户";
+ publish: "发布";
+ hotContent: "热门内容";
+ hotContentNew: "热门内容新";
+ };
translation: {
title: "AIToEarn官方网站";
content: "最好用的开源矩阵工具";
};
- // "hot-content": {
- // all: string;
- // loading: string;
- // noData: string;
- // rank: string;
- // cover: string;
- // title: string;
- // author: string;
- // category: string;
- // likes: string;
- // shares: string;
- // comments: string;
- // collections: string;
- // publishTime: string;
- // fans: string;
- // viewMore: string;
- // timeRange: string;
- // filter: string;
- // hotTopics: string;
- // viralTitles: string;
- // topics: string;
- // engagement: string;
- // rising: string;
- // noHotTopics: string;
- // noViralTitles: string;
- // noTopicData: string;
- // total: string;
- // items: string;
- // video: string;
- // noImage: string;
- // platform: string;
- // hotEvents: string;
- // hotContent: string;
- // };
}
export default Resources;
diff --git a/src/app/i18n/index.ts b/src/app/i18n/index.ts
index 9fe279cd..23674612 100644
--- a/src/app/i18n/index.ts
+++ b/src/app/i18n/index.ts
@@ -32,6 +32,8 @@ export async function useTranslation<
>
> = undefined,
>(lng: string, ns?: Ns, options: { keyPrefix?: KPrefix } = {}) {
+ // @ts-ignore
+ ns = ns || "translation";
const i18nextInstance = await initI18next(
lng,
Array.isArray(ns) ? (ns as string[]) : (ns as string),
diff --git a/src/app/i18n/settings.ts b/src/app/i18n/settings.ts
index c7a6e0b9..6d181a25 100644
--- a/src/app/i18n/settings.ts
+++ b/src/app/i18n/settings.ts
@@ -1,6 +1,4 @@
-import { FallbackLng } from "i18next";
-
-export const fallbackLng: FallbackLng = "en";
+export const fallbackLng = "en";
export const languages = [fallbackLng, "zh-CN"];
export const defaultNS = "common";
export const cookieName = "i18next";
diff --git a/src/utils/request.ts b/src/utils/request.ts
index 298371f6..64f86cdb 100644
--- a/src/utils/request.ts
+++ b/src/utils/request.ts
@@ -41,14 +41,6 @@ export async function request<T>(params: RequestParams) {
const res = await fetchService.request(params);
const data: ResponseType<T> = await res.json();
-
- // 语言拦截
- if (typeof window !== "undefined") {
- const lng = useUserStore.getState().lang;
- console.log(lng);
- // ...
- }
-
// @ts-ignore
if (data.code === "1" && data.data.statusCode === 401) {
useUserStore.getState().logout();