Skip to content

Commit

Permalink
Fix logout issue
Browse files Browse the repository at this point in the history
  • Loading branch information
an-lee committed Oct 17, 2024
1 parent 8b10ae3 commit 4b0cf63
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import { useContext, useEffect, useState } from "react";
export const EmailSettings = () => {
const { user, login, webApi } = useContext(AppSettingsProviderContext);
const [editing, setEditing] = useState(false);
const [email, setEmail] = useState(user.email);
const [email, setEmail] = useState(user?.email);
const [code, setCode] = useState("");
const [codeSent, setCodeSent] = useState<boolean>(false);
const [countdown, setCountdown] = useState<number>(0);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export const UserSettings = () => {
const { user, login, logout, webApi } = useContext(
AppSettingsProviderContext
);
const [name, setName] = useState(user.name);
const [name, setName] = useState(user?.name);
const [editing, setEditing] = useState(false);

const refreshProfile = () => {
Expand Down
8 changes: 6 additions & 2 deletions enjoy/src/renderer/pages/landing.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { LoginForm } from "@renderer/components";
import { AppSettingsProviderContext } from "@renderer/context";

export default () => {
const { initialized } = useContext(AppSettingsProviderContext);
const { initialized, EnjoyApp } = useContext(AppSettingsProviderContext);

return (
<div className="h-screen w-full px-4 py-6 lg:px-8 flex flex-col">
Expand All @@ -19,10 +19,14 @@ export default () => {
</div>
<div className="mt-auto">
<div className="flex mb-4 justify-end space-x-4">
{initialized && (
{initialized ? (
<Link data-testid="start-to-use-button" to="/" replace>
<Button className="w-24">{t("startToUse")}</Button>
</Link>
) : (
<Button className="w-24" onClick={() => EnjoyApp.app.reload()}>
{t("reload")}
</Button>
)}
</div>
</div>
Expand Down

0 comments on commit 4b0cf63

Please sign in to comment.