refactor(client): use generated API client and hooks
Signed-off-by: Noa Virellia <noa@requiem.garden>
This commit is contained in:
@@ -1,23 +1,9 @@
|
||||
import { getUserInfoOptions } from '@/client/@tanstack/react-query.gen';
|
||||
import { useSuspenseQuery } from '@tanstack/react-query';
|
||||
import { axiosClient } from '@/lib/axios';
|
||||
|
||||
export function useUserInfo() {
|
||||
return useSuspenseQuery({
|
||||
queryKey: ['userInfo'],
|
||||
queryFn: async () => {
|
||||
const response = await axiosClient.get<{
|
||||
username: string;
|
||||
user_id: string;
|
||||
email: string;
|
||||
type: string;
|
||||
nickname: string;
|
||||
subtitle: string;
|
||||
avatar: string;
|
||||
bio: string;
|
||||
}
|
||||
>('/user/info');
|
||||
return response.data;
|
||||
},
|
||||
staleTime: 10 * 60 * 1000,
|
||||
...getUserInfoOptions(),
|
||||
staleTime: 10 * 60 * 1000
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user