refactor(client): use generated API client and hooks
All checks were successful
Client CMS Check Build (NixCN CMS) TeamCity build finished
Backend Check Build (NixCN CMS) TeamCity build finished

Signed-off-by: Noa Virellia <noa@requiem.garden>
This commit is contained in:
2026-01-29 11:43:46 +08:00
parent f898243de5
commit a0f6087d3e
38 changed files with 4076 additions and 217 deletions

View File

@@ -9,7 +9,6 @@ import {
DialogTrigger,
} from '@/components/ui/dialog';
import { QRCode } from '@/components/ui/shadcn-io/qr-code';
import { useCheckinCode } from '@/hooks/data/useGetCheckInCode';
import { Button } from '../ui/button';
export function QrDialog(
@@ -35,23 +34,24 @@ export function QrDialog(
}
function QrSection({ eventId, enabled }: { eventId: string; enabled: boolean }) {
const { data } = useCheckinCode(eventId, enabled);
// const { data } = useCheckinCode(eventId, enabled);
const data = { data: { checkin_code: `dummy${eventId}${enabled}` } };
return data
? (
<>
<div className="border-2 px-4 py-8 border-muted rounded-xl flex flex-col items-center justify-center p-4">
<QRCode data={data.data.checkin_code} className="size-60" />
<>
<div className="border-2 px-4 py-8 border-muted rounded-xl flex flex-col items-center justify-center p-4">
<QRCode data={data.data.checkin_code} className="size-60" />
</div>
<DialogFooter>
<div className="flex flex-1 items-center ml-2 font-mono text-3xl tracking-widest text-primary/80 justify-center">
{data.data.checkin_code}
</div>
<DialogFooter>
<div className="flex flex-1 items-center ml-2 font-mono text-3xl tracking-widest text-primary/80 justify-center">
{data.data.checkin_code}
</div>
</DialogFooter>
</>
)
</DialogFooter>
</>
)
: (
<QrSectionSkeleton />
);
<QrSectionSkeleton />
);
}
function QrSectionSkeleton() {

View File

@@ -32,7 +32,7 @@ export function LoginForm({
event.preventDefault();
const formData = new FormData(formRef.current!);
const email = formData.get('email')! as string;
mutateAsync({ email, turnstile_token: token!, ...oauthParams }).then(() => {
mutateAsync({ body: { email, turnstile_token: token!, ...oauthParams } }).then(() => {
void navigate({ to: '/magicLinkSent', search: { email } });
}).catch((error) => {
console.error(error);

View File

@@ -29,7 +29,8 @@ const formSchema = z.object({
avatar: z.url().min(1),
});
export function EditProfileDialog() {
const { data: user } = useUserInfo();
const { data } = useUserInfo();
const user = data.data!;
const { mutateAsync } = useUpdateUser();
const form = useForm({
@@ -46,7 +47,7 @@ export function EditProfileDialog() {
value,
}) => {
try {
await mutateAsync(value);
await mutateAsync({ body: value });
toast.success('个人资料更新成功');
}
catch (error) {

View File

@@ -12,8 +12,9 @@ import { Button } from '../ui/button';
import { EditProfileDialog } from './edit-profile-dialog';
export function MainProfile() {
const { data: user } = useUserInfo();
const [bio, setBio] = useState<string | undefined>(() => base64ToUtf8(user.bio));
const { data } = useUserInfo();
const user = data.data!;
const [bio, setBio] = useState<string | undefined>(() => base64ToUtf8(user.bio ?? ''));
const [enableBioEdit, setEnableBioEdit] = useState(false);
const { mutateAsync } = useUpdateUser();
@@ -61,7 +62,7 @@ export function MainProfile() {
else {
if (!isNil(bio)) {
try {
await mutateAsync({ bio: utf8ToBase64(bio) });
await mutateAsync({ body: { bio: utf8ToBase64(bio) } });
setEnableBioEdit(false);
}
catch (error) {

View File

@@ -29,7 +29,8 @@ import { Skeleton } from '../ui/skeleton';
function NavUser_() {
const { isMobile } = useSidebar();
const { data: user } = useUserInfo();
const { data } = useUserInfo();
const user = data.data!;
const { logout } = useLogout();
return (