fixing things with profilke page

This commit is contained in:
Arjun Patel
2022-02-09 20:11:20 -08:00
parent afb2f3974f
commit 5f2fa566ae
3 changed files with 43 additions and 63 deletions
+14 -10
View File
@@ -43,6 +43,20 @@ export default function MainRecoilDataHandler() {
(async function () {
try {
// get my current user profile and stay updated to my status
const unsubUser = onSnapshot(
doc(db, Collections.users, currUser!.uid),
(doc) => {
if (doc.exists()) {
const nirvanaUser = doc.data() as User;
setNirvanaUser(nirvanaUser);
} else {
window.open("/teams/profile", "_self");
}
}
);
unsubs.push(unsubUser);
// get all conversations that I am a part of
const q = query(
collectionGroup(db, Collections.conversationMembers),
@@ -93,16 +107,6 @@ export default function MainRecoilDataHandler() {
unsubs.push(unsubscribeUserConvoMember);
// get my current user profile and stay updated to my status
const unsubUser = onSnapshot(
doc(db, Collections.users, currUser!.uid),
(doc) => {
const nirvanaUser = doc.data() as User;
setNirvanaUser(nirvanaUser);
}
);
unsubs.push(unsubUser);
// get every conversation where I am in the activeMembers list
const convoQuery = query(
collection(db, Collections.conversations),