mirror of
https://github.com/Radiquum/AniX.git
synced 2025-04-07 00:34:41 +00:00
fix: request to get user setting if no token exists
This commit is contained in:
parent
43d3aab01d
commit
19dbd69fd5
1 changed files with 52 additions and 40 deletions
|
@ -62,6 +62,10 @@ export const ProfileEditModal = (props: {
|
||||||
};
|
};
|
||||||
|
|
||||||
function useFetchInfo(url: string) {
|
function useFetchInfo(url: string) {
|
||||||
|
if (!props.token) {
|
||||||
|
url = "";
|
||||||
|
}
|
||||||
|
|
||||||
const { data, isLoading, error } = useSWR(url, useSWRfetcher);
|
const { data, isLoading, error } = useSWR(url, useSWRfetcher);
|
||||||
return [data, isLoading, error];
|
return [data, isLoading, error];
|
||||||
}
|
}
|
||||||
|
@ -184,6 +188,10 @@ export const ProfileEditModal = (props: {
|
||||||
}
|
}
|
||||||
}, [avatarModalProps.croppedImage]);
|
}, [avatarModalProps.croppedImage]);
|
||||||
|
|
||||||
|
if (!prefData || !loginData || prefError || loginError) {
|
||||||
|
return <></>;
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Modal
|
<Modal
|
||||||
|
@ -381,6 +389,8 @@ export const ProfileEditModal = (props: {
|
||||||
}
|
}
|
||||||
</Modal.Body>
|
</Modal.Body>
|
||||||
</Modal>
|
</Modal>
|
||||||
|
{props.token ?
|
||||||
|
<>
|
||||||
<ProfileEditPrivacyModal
|
<ProfileEditPrivacyModal
|
||||||
isOpen={privacyModalOpen}
|
isOpen={privacyModalOpen}
|
||||||
setIsOpen={setPrivacyModalOpen}
|
setIsOpen={setPrivacyModalOpen}
|
||||||
|
@ -422,5 +432,7 @@ export const ProfileEditModal = (props: {
|
||||||
profile_id={props.profile_id}
|
profile_id={props.profile_id}
|
||||||
/>
|
/>
|
||||||
</>
|
</>
|
||||||
|
: ""}
|
||||||
|
</>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Reference in a new issue