feat: 更新 @riwa/api-types 依赖地址,优化语言加载逻辑
This commit is contained in:
@@ -2,6 +2,7 @@ import type { App } from "@riwa/api-types";
|
||||
import type { WatchSource } from "vue";
|
||||
import { treaty } from "@elysiajs/eden";
|
||||
import { toastController } from "@ionic/vue";
|
||||
import { i18n } from "@/locales";
|
||||
|
||||
const client = treaty<App>(window.location.origin, {
|
||||
fetch: {
|
||||
@@ -54,7 +55,9 @@ export function safeClient<T, E>(
|
||||
if (res.error && res.status === 418) {
|
||||
if (!options.silent) {
|
||||
const toast = await toastController.create({
|
||||
message: (res.error as any).value.message,
|
||||
message: i18n.global.t((res.error as any).value.code, {
|
||||
...(res.error as any).value.context,
|
||||
}),
|
||||
duration: 3000,
|
||||
position: "bottom",
|
||||
color: "danger",
|
||||
|
||||
Reference in New Issue
Block a user