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.tsx9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/routes/authentication/AuthProvider.tsx b/src/routes/authentication/AuthProvider.tsx
index 6f577a73..8dd9fd73 100644
--- a/src/routes/authentication/AuthProvider.tsx
+++ b/src/routes/authentication/AuthProvider.tsx
@@ -24,6 +24,8 @@ interface AuthContextProps {
cover: string | null;
instaPosts: Array<InstagramPostType>;
recentSearches: Array<ProfilePreviewType>;
+ newMomentsAvailable: boolean;
+ updateMoments: (value: boolean) => void;
}
const NO_USER: UserType = {
userId: '',
@@ -43,6 +45,8 @@ export const AuthContext = createContext<AuthContextProps>({
cover: null,
instaPosts: [],
recentSearches: [],
+ newMomentsAvailable: true,
+ updateMoments: () => {},
});
/**
@@ -57,6 +61,7 @@ const AuthProvider: React.FC = ({children}) => {
const [recentSearches, setRecentSearches] = useState<
Array<ProfilePreviewType>
>([]);
+ const [newMomentsAvailable, setNewMomentsAvailable] = useState<boolean>(true);
const {userId} = user;
useEffect(() => {
if (!userId) {
@@ -90,6 +95,7 @@ const AuthProvider: React.FC = ({children}) => {
avatar,
cover,
instaPosts,
+ newMomentsAvailable,
login: (id, username) => {
setUser({...user, userId: id, username});
},
@@ -105,6 +111,9 @@ const AuthProvider: React.FC = ({children}) => {
}
},
recentSearches,
+ updateMoments: (value) => {
+ setNewMomentsAvailable(value);
+ },
}}>
{children}
</AuthContext.Provider>