feat(client): profile improvements
Some checks failed
Client CMS Check Build (NixCN CMS) TeamCity build failed
Backend Check Build (NixCN CMS) TeamCity build finished

Signed-off-by: Noa Virellia <noa@requiem.garden>
This commit is contained in:
2026-01-29 22:17:16 +08:00
parent 5da6e9ce25
commit b70095c99e
21 changed files with 1114 additions and 83 deletions

View File

@@ -1,10 +1,11 @@
import { useMutation } from '@tanstack/react-query';
import { createFileRoute, useNavigate } from '@tanstack/react-router';
import {
useEffect,
useState } from 'react';
useState,
} from 'react';
import z from 'zod';
import { postAuthTokenMutation } from '@/client/@tanstack/react-query.gen';
import { useMutation } from '@tanstack/react-query';
import { setRefreshToken, setToken } from '@/lib/token';
const tokenCodeSchema = z.object({
@@ -24,20 +25,20 @@ function RouteComponent() {
const mutation = useMutation({
...postAuthTokenMutation(),
onSuccess: (data) => {
setToken(data.data?.access_token!)
setRefreshToken(data.data?.refresh_token!)
setToken(data.data?.access_token!);
setRefreshToken(data.data?.refresh_token!);
void navigate({ to: '/' });
},
onError: () => {
setStatus('Error getting token');
}
})
},
});
useEffect(() => {
if (mutation.isIdle) {
mutation.mutate({ body: { code } })
mutation.mutate({ body: { code } });
}
}, [])
}, []);
return <div>{status}</div>;
}