diff options
| author | Ellie Huxtable <ellie@atuin.sh> | 2024-07-10 15:56:33 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-07-10 15:56:33 +0100 |
| commit | 8d9f677c4e9ccfcc6dc9297864dc49446fb5ee59 (patch) | |
| tree | 1fe507403c4d690937834a815a663336bf104039 /ui/src/components/LoginOrRegister.tsx | |
| parent | chore(deps): update to tonic 0.12, prost 0.13 (#2250) (diff) | |
| download | atuin-8d9f677c4e9ccfcc6dc9297864dc49446fb5ee59.zip | |
feat(gui): use fancy new side nav (#2243)
* feat(gui): use fancy new side nav
* compact only sidebar, no expand-collapse
* custom drag region, remove titlebar
* add user popup
* wire up login/logout/register, move user button to bottom and add menu
* link help and feedback to forum
Diffstat (limited to 'ui/src/components/LoginOrRegister.tsx')
| -rw-r--r-- | ui/src/components/LoginOrRegister.tsx | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/ui/src/components/LoginOrRegister.tsx b/ui/src/components/LoginOrRegister.tsx index f05a9a24..97f8a790 100644 --- a/ui/src/components/LoginOrRegister.tsx +++ b/ui/src/components/LoginOrRegister.tsx @@ -6,6 +6,7 @@ import { useStore } from "@/state/store"; interface LoginProps { toggleRegister: () => void; + onClose: () => void; } function Login(props: LoginProps) { @@ -24,7 +25,7 @@ function Login(props: LoginProps) { try { await login(username, password, key); refreshUser(); - console.log("Logged in"); + props.onClose(); } catch (e: any) { console.error(e); setErrors(e); @@ -171,6 +172,7 @@ function Login(props: LoginProps) { interface RegisterProps { toggleLogin: () => void; + onClose: () => void; } function Register(props: RegisterProps) { @@ -185,13 +187,11 @@ function Register(props: RegisterProps) { const email = form.email.value; const password = form.password.value; - console.log("Logging in..."); try { await register(username, email, password); refreshUser(); - console.log("Logged in"); + props.onClose(); } catch (e: any) { - console.error(e); setErrors(e); } }; @@ -330,12 +330,12 @@ function Register(props: RegisterProps) { ); } -export default function LoginOrRegister() { +export default function LoginOrRegister({ onClose }: { onClose: () => void }) { let [login, setLogin] = useState<boolean>(false); if (login) { - return <Login toggleRegister={() => setLogin(false)} />; + return <Login onClose={onClose} toggleRegister={() => setLogin(false)} />; } - return <Register toggleLogin={() => setLogin(true)} />; + return <Register onClose={onClose} toggleLogin={() => setLogin(true)} />; } |
