feat: 更新 @riwa/api-types 依赖至 0.0.49,优化用户数据处理逻辑
This commit is contained in:
@@ -32,7 +32,7 @@
|
||||
"@elysiajs/eden": "^1.4.5",
|
||||
"@ionic/vue": "^8.7.11",
|
||||
"@ionic/vue-router": "^8.7.11",
|
||||
"@riwa/api-types": "http://192.168.1.27:9527/api/riwa-api-types-0.0.44.tgz",
|
||||
"@riwa/api-types": "http://192.168.1.27:9527/api/riwa-api-types-0.0.49.tgz",
|
||||
"@tailwindcss/vite": "^4.1.18",
|
||||
"@vee-validate/yup": "^4.15.1",
|
||||
"@vueuse/core": "^14.1.0",
|
||||
|
||||
12
pnpm-lock.yaml
generated
12
pnpm-lock.yaml
generated
@@ -54,8 +54,8 @@ importers:
|
||||
specifier: ^8.7.11
|
||||
version: 8.7.11(@stencil/core@4.39.0)(vue-router@4.6.3(vue@3.5.25(typescript@5.9.3)))(vue@3.5.25(typescript@5.9.3))
|
||||
'@riwa/api-types':
|
||||
specifier: http://192.168.1.27:9527/api/riwa-api-types-0.0.44.tgz
|
||||
version: http://192.168.1.27:9527/api/riwa-api-types-0.0.44.tgz(@elysiajs/eden@1.4.5(elysia@1.4.18(@sinclair/typebox@0.34.41)(exact-mirror@0.2.5(@sinclair/typebox@0.34.41))(file-type@21.1.1)(openapi-types@12.1.3)(typescript@5.9.3)))
|
||||
specifier: http://192.168.1.27:9527/api/riwa-api-types-0.0.49.tgz
|
||||
version: http://192.168.1.27:9527/api/riwa-api-types-0.0.49.tgz(@elysiajs/eden@1.4.5(elysia@1.4.18(@sinclair/typebox@0.34.41)(exact-mirror@0.2.5(@sinclair/typebox@0.34.41))(file-type@21.1.1)(openapi-types@12.1.3)(typescript@5.9.3)))
|
||||
'@tailwindcss/vite':
|
||||
specifier: ^4.1.18
|
||||
version: 4.1.18(vite@7.2.7(@types/node@24.10.2)(jiti@2.6.1)(lightningcss@1.30.2)(terser@5.44.1)(yaml@2.8.2))
|
||||
@@ -1354,9 +1354,9 @@ packages:
|
||||
resolution: {integrity: sha512-QNqXyfVS2wm9hweSYD2O7F0G06uurj9kZ96TRQE5Y9hU7+tgdZwIkbAKc5Ocy1HxEY2kuDQa6cQ1WRs/O5LFKA==}
|
||||
engines: {node: ^12.20.0 || ^14.18.0 || >=16.0.0}
|
||||
|
||||
'@riwa/api-types@http://192.168.1.27:9527/api/riwa-api-types-0.0.44.tgz':
|
||||
resolution: {tarball: http://192.168.1.27:9527/api/riwa-api-types-0.0.44.tgz}
|
||||
version: 0.0.44
|
||||
'@riwa/api-types@http://192.168.1.27:9527/api/riwa-api-types-0.0.49.tgz':
|
||||
resolution: {tarball: http://192.168.1.27:9527/api/riwa-api-types-0.0.49.tgz}
|
||||
version: 0.0.49
|
||||
peerDependencies:
|
||||
'@elysiajs/eden': ^1.4.5
|
||||
|
||||
@@ -6453,7 +6453,7 @@ snapshots:
|
||||
|
||||
'@pkgr/core@0.2.9': {}
|
||||
|
||||
'@riwa/api-types@http://192.168.1.27:9527/api/riwa-api-types-0.0.44.tgz(@elysiajs/eden@1.4.5(elysia@1.4.18(@sinclair/typebox@0.34.41)(exact-mirror@0.2.5(@sinclair/typebox@0.34.41))(file-type@21.1.1)(openapi-types@12.1.3)(typescript@5.9.3)))':
|
||||
'@riwa/api-types@http://192.168.1.27:9527/api/riwa-api-types-0.0.49.tgz(@elysiajs/eden@1.4.5(elysia@1.4.18(@sinclair/typebox@0.34.41)(exact-mirror@0.2.5(@sinclair/typebox@0.34.41))(file-type@21.1.1)(openapi-types@12.1.3)(typescript@5.9.3)))':
|
||||
dependencies:
|
||||
'@elysiajs/eden': 1.4.5(elysia@1.4.18(@sinclair/typebox@0.34.41)(exact-mirror@0.2.5(@sinclair/typebox@0.34.41))(file-type@21.1.1)(openapi-types@12.1.3)(typescript@5.9.3))
|
||||
|
||||
|
||||
@@ -25,9 +25,7 @@ export type WithdrawBody = Omit<Parameters<typeof client.api.withdraw.post>[0],
|
||||
withdrawMethod: WithdrawMethodEnum;
|
||||
};
|
||||
|
||||
export type UserProfileData = Treaty.Data<typeof client.api.user.profile.get>["userProfile"];
|
||||
|
||||
export type UserData = Treaty.Data<typeof client.api.user.profile.get>["user"];
|
||||
export type UserProfileData = Treaty.Data<typeof client.api.user.profile.get>;
|
||||
|
||||
export type UpdateUserProfileBody = TreatyBody<typeof client.api.user.profile.put>;
|
||||
|
||||
|
||||
@@ -1,15 +1,13 @@
|
||||
import type { UserData, UserProfileData } from "@/api/types";
|
||||
import type { UserProfileData } from "@/api/types";
|
||||
import { client, safeClient } from "@/api";
|
||||
|
||||
interface State {
|
||||
user: UserData | null;
|
||||
userProfile: UserProfileData | null;
|
||||
}
|
||||
|
||||
export const useUserStore = defineStore("user", () => {
|
||||
const token = useStorage<string | null>("user-token", null);
|
||||
const state = reactive<State>({
|
||||
user: null,
|
||||
userProfile: null,
|
||||
});
|
||||
|
||||
@@ -17,8 +15,7 @@ export const useUserStore = defineStore("user", () => {
|
||||
|
||||
async function updateProfile() {
|
||||
const { data } = await safeClient(client.api.user.profile.get(), { silent: true });
|
||||
state.userProfile = data.value?.userProfile || null;
|
||||
state.user = data.value?.user || null;
|
||||
state.userProfile = data.value || null;
|
||||
}
|
||||
|
||||
function setToken(value: string) {
|
||||
@@ -28,7 +25,6 @@ export const useUserStore = defineStore("user", () => {
|
||||
function signOut() {
|
||||
token.value = null;
|
||||
state.userProfile = null;
|
||||
state.user = null;
|
||||
}
|
||||
|
||||
return {
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
import { copyOutline, qrCodeOutline, shareOutline } from "ionicons/icons";
|
||||
|
||||
const userStore = useUserStore();
|
||||
const { user } = storeToRefs(userStore);
|
||||
const { userProfile } = storeToRefs(userStore);
|
||||
</script>
|
||||
|
||||
<template>
|
||||
@@ -23,7 +23,7 @@ const { user } = storeToRefs(userStore);
|
||||
<ui-avatar class="size-18" />
|
||||
</div>
|
||||
<IonText class="user-email">
|
||||
{{ user?.email }}
|
||||
{{ userProfile?.user.email }}
|
||||
</IonText>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -8,8 +8,8 @@ import { safeClient } from "@/api";
|
||||
import { authClient, emailSchema } from "@/auth";
|
||||
|
||||
const userStore = useUserStore();
|
||||
const { user } = storeToRefs(userStore);
|
||||
const email = ref(user.value?.email || "");
|
||||
const { userProfile } = storeToRefs(userStore);
|
||||
const email = ref(userProfile.value?.user?.email || "");
|
||||
const { updateProfile } = useUserStore();
|
||||
const { t } = useI18n();
|
||||
const countdown = ref(0);
|
||||
|
||||
@@ -6,7 +6,7 @@ import { authClient } from "@/auth";
|
||||
|
||||
const router = useRouter();
|
||||
const userStore = useUserStore();
|
||||
const { user, userProfile } = storeToRefs(userStore);
|
||||
const { userProfile } = storeToRefs(userStore);
|
||||
|
||||
async function handleSignOut() {
|
||||
const alert = await alertController.create({
|
||||
@@ -118,7 +118,7 @@ function handleCopyUid() {
|
||||
</div>
|
||||
</div>
|
||||
<div class="end">
|
||||
{{ user?.email }}
|
||||
{{ userProfile?.user?.email }}
|
||||
</div>
|
||||
</div>
|
||||
</ion-item>
|
||||
|
||||
@@ -5,8 +5,8 @@ import { safeClient } from "@/api";
|
||||
import { authClient } from "@/auth";
|
||||
|
||||
const userStore = useUserStore();
|
||||
const { user } = storeToRefs(userStore);
|
||||
const username = ref(user.value?.username || "");
|
||||
const { userProfile } = storeToRefs(userStore);
|
||||
const username = ref(userProfile.value?.user?.username || "");
|
||||
const { updateProfile } = useUserStore();
|
||||
|
||||
async function handleSave() {
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
import { chevronForwardOutline, copyOutline, qrCodeOutline } from "ionicons/icons";
|
||||
|
||||
const userStore = useUserStore();
|
||||
const { user, userProfile } = storeToRefs(userStore);
|
||||
const { userProfile } = storeToRefs(userStore);
|
||||
</script>
|
||||
|
||||
<template>
|
||||
@@ -11,7 +11,7 @@ const { user, userProfile } = storeToRefs(userStore);
|
||||
<ui-avatar class="size-18" />
|
||||
<div>
|
||||
<div class="user-name">
|
||||
{{ user?.email }}
|
||||
{{ userProfile?.user?.email }}
|
||||
</div>
|
||||
<div class="user-uid mt-1 text-xs text-text-100">
|
||||
UID: {{ userProfile?.uid }}
|
||||
|
||||
Reference in New Issue
Block a user