Skip to content

Commit e7350c0

Browse files
authored
feat: add logout button on failed request (#8)
1 parent 25a0526 commit e7350c0

File tree

2 files changed

+16
-3
lines changed

2 files changed

+16
-3
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
"preview": "vite preview",
2222
"typecheck": "tsc -p tsconfig.node.json --noEmit && tsc -p tsconfig.web.json --noEmit",
2323
"lint:write": "biome check --write --unsafe",
24-
"format:write": "biome format --write --unsafe",
24+
"format:write": "biome format --write",
2525
"check:write": "pnpm run lint:write && pnpm run typecheck",
2626
"generate-client": "tsx scripts/update-openapi-client.ts"
2727
},

src/renderer/components/TaskList.tsx

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import type { Task } from "@shared/types";
1212
import type React from "react";
1313
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
1414
import { useHotkeys } from "react-hotkeys-hook";
15+
import { useAuthStore } from "../stores/authStore";
1516
import { useStatusBarStore } from "../stores/statusBarStore";
1617
import { useTaskStore } from "../stores/taskStore";
1718
import { AsciiArt } from "./AsciiArt";
@@ -55,6 +56,7 @@ export function TaskList({
5556
const setFilter = useTaskStore((state) => state.setFilter);
5657

5758
const { setStatusBar, reset } = useStatusBarStore();
59+
const { logout } = useAuthStore();
5860
const listRef = useRef<HTMLDivElement>(null);
5961

6062
useEffect(() => {
@@ -279,9 +281,20 @@ export function TaskList({
279281
if (error) {
280282
return (
281283
<Box height="100%" p="6">
282-
<Flex direction="column" align="center" justify="center" height="100%">
284+
<Flex
285+
direction="column"
286+
align="center"
287+
justify="center"
288+
height="100%"
289+
gap="4"
290+
>
283291
<Text color="red">{error}</Text>
284-
<Button onClick={() => fetchTasks()}>Retry</Button>
292+
<Flex gap="2">
293+
<Button onClick={() => fetchTasks()}>Retry</Button>
294+
<Button variant="outline" onClick={logout}>
295+
Logout
296+
</Button>
297+
</Flex>
285298
</Flex>
286299
</Box>
287300
);

0 commit comments

Comments
 (0)