aboutsummaryrefslogtreecommitdiff
path: root/src/routes/viewProfile/ProfileProvider.tsx
diff options
context:
space:
mode:
Diffstat (limited to 'src/routes/viewProfile/ProfileProvider.tsx')
-rw-r--r--src/routes/viewProfile/ProfileProvider.tsx10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/routes/viewProfile/ProfileProvider.tsx b/src/routes/viewProfile/ProfileProvider.tsx
index 1af7917d..8fb9a011 100644
--- a/src/routes/viewProfile/ProfileProvider.tsx
+++ b/src/routes/viewProfile/ProfileProvider.tsx
@@ -8,7 +8,6 @@ import {
loadAvatar,
loadCover,
loadInstaPosts,
- loadRecentlySearchedUsers,
} from '../../services';
interface ProfileContextProps {
@@ -18,6 +17,8 @@ interface ProfileContextProps {
avatar: string | null;
cover: string | null;
instaPosts: Array<InstagramPostType>;
+ newMomentsAvailable: boolean;
+ updateMoments: (value: boolean) => void;
}
const NO_USER: UserType = {
userId: '',
@@ -35,6 +36,8 @@ export const ProfileContext = createContext<ProfileContextProps>({
avatar: null,
cover: null,
instaPosts: [],
+ newMomentsAvailable: true,
+ updateMoments: () => {},
});
/**
@@ -46,6 +49,7 @@ const ProfileProvider: React.FC = ({children}) => {
const [avatar, setAvatar] = useState<string | null>(null);
const [cover, setCover] = useState<string | null>(null);
const [instaPosts, setInstaPosts] = useState<Array<InstagramPostType>>([]);
+ const [newMomentsAvailable, setNewMomentsAvailable] = useState<boolean>(true);
const {userId} = user;
useEffect(() => {
@@ -79,9 +83,13 @@ const ProfileProvider: React.FC = ({children}) => {
avatar,
cover,
instaPosts,
+ newMomentsAvailable,
loadProfile: (id, username) => {
setUser({...user, userId: id, username});
},
+ updateMoments: (value) => {
+ setNewMomentsAvailable(value);
+ },
}}>
{children}
</ProfileContext.Provider>