fix: request to get user setting if no token exists

This commit is contained in:
Kentai Radiquum 2025-03-22 00:40:55 +05:00
parent 43d3aab01d
commit 19dbd69fd5
Signed by: Radiquum
GPG key ID: 858E8EE696525EED

View file

@ -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}
/> />
</> </>
: ""}
</>
); );
}; };