Skip to content

Commit

Permalink
Update SgyInitResults.tsx
Browse files Browse the repository at this point in the history
  • Loading branch information
33tm committed Sep 28, 2023
1 parent 6c38cb7 commit 146975f
Showing 1 changed file with 10 additions and 12 deletions.
22 changes: 10 additions & 12 deletions client/src/components/firebase/SgyInitResults.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import Loading from '../layout/Loading';

// Auth
import { useAuth, useFirestore, useFunctions, useUser } from 'reactfire';
import { onAuthStateChanged } from 'firebase/auth';
import { httpsCallable } from 'firebase/functions';
import { updateUserData } from '../../util/firestore';

Expand All @@ -32,18 +31,17 @@ export default function SgyInitResults() {

// Set the results to the value returned by initialization to be displayed
useEffect(() => {
onAuthStateChanged(auth, (user) => {
if (user && sgyModal) {
// console.log('hey!');
const init = httpsCallable(functions, "sgyfetch-init");
init().then(r => {
// console.log(r);
setResults(r);
});
}
})
if (!auth.currentUser) return;
if (auth.currentUser && sgyModal) {
// console.log('hey!');
const init = httpsCallable(functions, "sgyfetch-init");
init().then(r => {
// console.log(r);
setResults(r);
});
}
// return (() => {console.log('I am unmounted!!!!!')});
}, [])
}, [auth.currentUser])

const closeDialog = () => {
setSgyModal(false);
Expand Down

0 comments on commit 146975f

Please sign in to comment.