All files / src/hooks/queries useSettingsQueries.ts

100% Statements 5/5
100% Branches 0/0
100% Functions 4/4
100% Lines 5/5

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22          289x     83x 82x           287x   72x        
import { useQuery } from "@tanstack/react-query";
import { authApi } from "../../lib/api";
import { queryKeys } from "../../lib/query-keys";
 
export function useUserProfile() {
	return useQuery({
		queryKey: queryKeys.settings.profile(),
		queryFn: async () => {
			const response = await authApi.getProfile();
			return response.data;
		},
	});
}
 
export function useLinkedAccounts() {
	return useQuery({
		queryKey: queryKeys.settings.accounts(),
		queryFn: () => authApi.listAccounts(),
		staleTime: 60 * 60 * 1000, // 1 hour — account providers rarely change
	});
}