Refactored useQuery functions.

This commit is contained in:
Mike Cao 2023-12-01 20:27:59 -08:00
parent be550cc440
commit b578162cb6
33 changed files with 179 additions and 151 deletions

View file

@ -14,15 +14,15 @@ export function UserSettings({ userId }) {
const [tab, setTab] = useState('details');
const { get, useQuery } = useApi();
const { showToast } = useToasts();
const { data, isLoading } = useQuery(
['user', userId],
() => {
const { data, isLoading } = useQuery({
queryKey: ['user', userId],
queryFn: () => {
if (userId) {
return get(`/users/${userId}`);
}
},
{ cacheTime: 0 },
);
cacheTime: 0,
});
const handleSave = data => {
showToast({ message: formatMessage(messages.saved), variant: 'success' });