make every button that requires an account pop up a login prompt
This commit is contained in:
@@ -1,10 +1,8 @@
|
||||
import { useState } from 'react'
|
||||
import { useAuth } from '../auth'
|
||||
import AuthModal from './AuthModal'
|
||||
import { useAuth, useAuthModal } from '../auth'
|
||||
|
||||
export default function ProfileBar() {
|
||||
const { user, loading, logout } = useAuth()
|
||||
const [showAuth, setShowAuth] = useState(false)
|
||||
const { openAuthModal } = useAuthModal()
|
||||
|
||||
return (
|
||||
<>
|
||||
@@ -26,12 +24,11 @@ export default function ProfileBar() {
|
||||
</button>
|
||||
</div>
|
||||
) : (
|
||||
<button className="btn btn-primary" onClick={() => setShowAuth(true)}>
|
||||
<button className="btn btn-primary" onClick={openAuthModal}>
|
||||
Войти
|
||||
</button>
|
||||
)}
|
||||
</div>
|
||||
{showAuth && <AuthModal onClose={() => setShowAuth(false)} />}
|
||||
</>
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user