Created
April 5, 2022 18:07
-
-
Save polluterofminds/2372abfbd871152bffe8aa78bdc8de99 to your computer and use it in GitHub Desktop.
Members Only Step 7
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { useState, useEffect } from 'react' | |
import { signOut, useSession } from "next-auth/react" | |
import Link from 'next/link'; | |
const Gallery = () => { | |
const { data: session, status } = useSession() | |
const [loading, setLoading] = useState(true); | |
useEffect(() => { | |
if(session) { | |
// loadFiles | |
setLoading(false); | |
} | |
}, [session]); | |
if(loading) { | |
<div> | |
<h1>Loading...</h1> | |
</div> | |
} else { | |
return ( | |
<div> | |
{ | |
!session ? | |
<div> | |
<h1>You need to sign in</h1> | |
<Link to="/">Sign in</Link> | |
</div> : | |
<div> | |
Gallery | |
</div> | |
} | |
</div> | |
) | |
} | |
} | |
export default Gallery |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment