chore: initialize qiming workspace repository
This commit is contained in:
35
qiming-mobile/servers/i18n.uts
Normal file
35
qiming-mobile/servers/i18n.uts
Normal file
@@ -0,0 +1,35 @@
|
||||
import request from "./useRequest";
|
||||
import type { RequestResponse } from "@/types/interfaces/request";
|
||||
import type { I18nLangDto } from "@/types/interfaces/i18n";
|
||||
import { I18N_SET_LANG_API } from "@/constants/i18n.constants";
|
||||
|
||||
export type LangMap = Record<string, string>;
|
||||
|
||||
// 查询语言列表
|
||||
export function apiI18nLangList() {
|
||||
return request<RequestResponse<I18nLangDto[]>>({
|
||||
url: "/api/i18n/lang/list",
|
||||
method: "GET",
|
||||
});
|
||||
}
|
||||
|
||||
// 查询语言字典
|
||||
export function apiI18nQuery(lang: string = "") {
|
||||
const side = "Mobile";
|
||||
const query = lang
|
||||
? `?lang=${encodeURIComponent(lang)}&side=${side}`
|
||||
: `?side=${side}`;
|
||||
return request<RequestResponse<LangMap>>({
|
||||
url: `/api/i18n/query${query}`,
|
||||
method: "GET",
|
||||
});
|
||||
}
|
||||
|
||||
// 设置用户语言(后端专用接口)
|
||||
export function apiI18nSetLang(lang: string) {
|
||||
return request<RequestResponse<any>>({
|
||||
url: I18N_SET_LANG_API,
|
||||
method: "POST",
|
||||
data: { lang },
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user