mirror of
https://github.com/Radiquum/AniX.git
synced 2025-04-05 07:44:38 +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) {
|
||||
if (!props.token) {
|
||||
url = "";
|
||||
}
|
||||
|
||||
const { data, isLoading, error } = useSWR(url, useSWRfetcher);
|
||||
return [data, isLoading, error];
|
||||
}
|
||||
|
@ -184,6 +188,10 @@ export const ProfileEditModal = (props: {
|
|||
}
|
||||
}, [avatarModalProps.croppedImage]);
|
||||
|
||||
if (!prefData || !loginData || prefError || loginError) {
|
||||
return <></>;
|
||||
}
|
||||
|
||||
return (
|
||||
<>
|
||||
<Modal
|
||||
|
@ -381,46 +389,50 @@ export const ProfileEditModal = (props: {
|
|||
}
|
||||
</Modal.Body>
|
||||
</Modal>
|
||||
<ProfileEditPrivacyModal
|
||||
isOpen={privacyModalOpen}
|
||||
setIsOpen={setPrivacyModalOpen}
|
||||
token={props.token}
|
||||
setting={privacyModalSetting}
|
||||
privacySettings={privacySettings}
|
||||
setPrivacySettings={setPrivacySettings}
|
||||
/>
|
||||
<ProfileEditStatusModal
|
||||
isOpen={statusModalOpen}
|
||||
setIsOpen={setStatusModalOpen}
|
||||
token={props.token}
|
||||
status={status}
|
||||
setStatus={setStatus}
|
||||
profile_id={props.profile_id}
|
||||
/>
|
||||
<ProfileEditSocialModal
|
||||
isOpen={socialModalOpen}
|
||||
setIsOpen={setSocialModalOpen}
|
||||
token={props.token}
|
||||
profile_id={props.profile_id}
|
||||
/>
|
||||
<CropModal
|
||||
{...avatarModalProps}
|
||||
cropParams={{
|
||||
aspectRatio: 1 / 1,
|
||||
forceAspect: true,
|
||||
guides: true,
|
||||
width: 600,
|
||||
height: 600,
|
||||
}}
|
||||
setCropModalProps={setAvatarModalProps}
|
||||
/>
|
||||
<ProfileEditLoginModal
|
||||
isOpen={loginModalOpen}
|
||||
setIsOpen={setLoginModalOpen}
|
||||
token={props.token}
|
||||
setLogin={setLogin}
|
||||
profile_id={props.profile_id}
|
||||
/>
|
||||
{props.token ?
|
||||
<>
|
||||
<ProfileEditPrivacyModal
|
||||
isOpen={privacyModalOpen}
|
||||
setIsOpen={setPrivacyModalOpen}
|
||||
token={props.token}
|
||||
setting={privacyModalSetting}
|
||||
privacySettings={privacySettings}
|
||||
setPrivacySettings={setPrivacySettings}
|
||||
/>
|
||||
<ProfileEditStatusModal
|
||||
isOpen={statusModalOpen}
|
||||
setIsOpen={setStatusModalOpen}
|
||||
token={props.token}
|
||||
status={status}
|
||||
setStatus={setStatus}
|
||||
profile_id={props.profile_id}
|
||||
/>
|
||||
<ProfileEditSocialModal
|
||||
isOpen={socialModalOpen}
|
||||
setIsOpen={setSocialModalOpen}
|
||||
token={props.token}
|
||||
profile_id={props.profile_id}
|
||||
/>
|
||||
<CropModal
|
||||
{...avatarModalProps}
|
||||
cropParams={{
|
||||
aspectRatio: 1 / 1,
|
||||
forceAspect: true,
|
||||
guides: true,
|
||||
width: 600,
|
||||
height: 600,
|
||||
}}
|
||||
setCropModalProps={setAvatarModalProps}
|
||||
/>
|
||||
<ProfileEditLoginModal
|
||||
isOpen={loginModalOpen}
|
||||
setIsOpen={setLoginModalOpen}
|
||||
token={props.token}
|
||||
setLogin={setLogin}
|
||||
profile_id={props.profile_id}
|
||||
/>
|
||||
</>
|
||||
: ""}
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
|
Loading…
Add table
Reference in a new issue