Skip to content

Commit 4b0cf63

Browse files
committed
Fix logout issue
1 parent 8b10ae3 commit 4b0cf63

File tree

3 files changed

+8
-4
lines changed

3 files changed

+8
-4
lines changed

enjoy/src/renderer/components/preferences/email-settings.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import { useContext, useEffect, useState } from "react";
1616
export const EmailSettings = () => {
1717
const { user, login, webApi } = useContext(AppSettingsProviderContext);
1818
const [editing, setEditing] = useState(false);
19-
const [email, setEmail] = useState(user.email);
19+
const [email, setEmail] = useState(user?.email);
2020
const [code, setCode] = useState("");
2121
const [codeSent, setCodeSent] = useState<boolean>(false);
2222
const [countdown, setCountdown] = useState<number>(0);

enjoy/src/renderer/components/preferences/user-settings.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ export const UserSettings = () => {
3030
const { user, login, logout, webApi } = useContext(
3131
AppSettingsProviderContext
3232
);
33-
const [name, setName] = useState(user.name);
33+
const [name, setName] = useState(user?.name);
3434
const [editing, setEditing] = useState(false);
3535

3636
const refreshProfile = () => {

enjoy/src/renderer/pages/landing.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { LoginForm } from "@renderer/components";
66
import { AppSettingsProviderContext } from "@renderer/context";
77

88
export default () => {
9-
const { initialized } = useContext(AppSettingsProviderContext);
9+
const { initialized, EnjoyApp } = useContext(AppSettingsProviderContext);
1010

1111
return (
1212
<div className="h-screen w-full px-4 py-6 lg:px-8 flex flex-col">
@@ -19,10 +19,14 @@ export default () => {
1919
</div>
2020
<div className="mt-auto">
2121
<div className="flex mb-4 justify-end space-x-4">
22-
{initialized && (
22+
{initialized ? (
2323
<Link data-testid="start-to-use-button" to="/" replace>
2424
<Button className="w-24">{t("startToUse")}</Button>
2525
</Link>
26+
) : (
27+
<Button className="w-24" onClick={() => EnjoyApp.app.reload()}>
28+
{t("reload")}
29+
</Button>
2630
)}
2731
</div>
2832
</div>

0 commit comments

Comments
 (0)