Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function AccountEditor() {
const classes = useStyles()
const firebase = useFirebaseApp()
const auth = useUser()
const accountRef = firebase.database().ref(`users/${auth.uid}`)
const profileSnap = useDatabaseObject(accountRef)
const profile = profileSnap.snapshot.val()
function updateAccount(newAccount) {
return firebase
.updateProfile(newAccount)
.then(() => accountRef.update(newAccount))
.catch(error => {
console.error('Error updating profile', error.message || error) // eslint-disable-line no-console
return Promise.reject(error)
})
}
return (
function useProjectsList() {
// Get current user (loading handled by Suspense in ProjectsList)
const auth = useUser()
const firebase = useFirebaseApp()
// Create a ref for projects owned by the current user
const projectsRef = firebase
.database()
.ref('projects')
.orderByChild('createdBy')
.equalTo(auth.uid)
// Query for projects (loading handled by Suspense in ProjectsList)
const projects = useDatabaseList(projectsRef)
// New dialog
const [newDialogOpen, changeDialogState] = useState(false)
const toggleDialog = () => changeDialogState(!newDialogOpen)
const FirebaseAuthStateButton = () => {
const user = useUser();
return user ? : ;
};
function Navbar() {
const classes = useStyles()
const auth = useUser()
const authExists = !!auth && !!auth.uid
return (
{authExists ? (
) : (
<button data-test="sign-in">
Sign In
</button>
)}