aboutsummaryrefslogtreecommitdiff
path: root/src/routes/authentication/AuthProvider.tsx
diff options
context:
space:
mode:
Diffstat (limited to 'src/routes/authentication/AuthProvider.tsx')
-rw-r--r--src/routes/authentication/AuthProvider.tsx13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/routes/authentication/AuthProvider.tsx b/src/routes/authentication/AuthProvider.tsx
index 7da47b71..7046d04f 100644
--- a/src/routes/authentication/AuthProvider.tsx
+++ b/src/routes/authentication/AuthProvider.tsx
@@ -40,6 +40,8 @@ interface AuthContextProps {
blockedUsers: ProfilePreviewType[];
blockedUsersNeedUpdate: boolean;
updateBlockedUsers: (value: boolean) => void;
+ isEditedProfile: boolean;
+ updateIsEditedProfile: (value: boolean) => void;
}
const NO_USER: UserType = {
@@ -51,6 +53,8 @@ const NO_PROFILE: ProfileType = {
biography: '',
website: '',
name: '',
+ gender: '',
+ birthday: undefined,
};
const NO_SOCIAL_ACCOUNTS: Record<string, SocialAccountType> = {
@@ -79,6 +83,8 @@ export const AuthContext = createContext<AuthContextProps>({
blockedUsers: [],
blockedUsersNeedUpdate: true,
updateBlockedUsers: () => {},
+ isEditedProfile: false,
+ updateIsEditedProfile: () => {},
});
/**
@@ -110,6 +116,7 @@ const AuthProvider: React.FC = ({children}) => {
const [blockedUsersNeedUpdate, setBlockedUsersNeedUpdate] = useState<boolean>(
true,
);
+ const [isEditedProfile, setIsEditedProfile] = useState<boolean>(false);
const {userId} = user;
useEffect(() => {
@@ -149,7 +156,7 @@ const AuthProvider: React.FC = ({children}) => {
}
};
loadData();
- }, [userId]);
+ }, [userId, isEditedProfile]);
useEffect(() => {
const loadNewMoments = async () => {
@@ -245,6 +252,7 @@ const AuthProvider: React.FC = ({children}) => {
followersNeedUpdate,
blockedUsers,
blockedUsersNeedUpdate,
+ isEditedProfile,
login: (id, username) => {
setUser({...user, userId: id, username});
},
@@ -274,6 +282,9 @@ const AuthProvider: React.FC = ({children}) => {
updateBlockedUsers: (value) => {
setBlockedUsersNeedUpdate(value);
},
+ updateIsEditedProfile: (value: boolean) => {
+ setIsEditedProfile(value);
+ },
}}>
{children}
</AuthContext.Provider>