MCPcopy Create free account
hub / github.com/TryCatchLearn/Overflow / ErrorButtons

Function ErrorButtons

webapp/src/app/session/ErrorButtons.tsx:7–35  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

5import {useState, useTransition} from "react";
6import {handleError} from "@/lib/util";
7export default function ErrorButtons() {
8 const [pending, startTransition] = useTransition();
9 const [target, setTarget] = useState(0);
10
11 const onClick = (code: number) => {
12 setTarget(code);
13 startTransition(async () => {
14 const {error} = await triggerError(code);
15 if (error) handleError(error);
16 setTarget(0);
17 })
18 }
19
20 return (
21 <div className='flex gap-3'>
22 {[400, 401, 403, 404, 500].map((code) => (
23 <Button
24 onPress={() => onClick(code)}
25 color='primary'
26 key={code}
27 type='button'
28 isLoading={pending && target === code}
29 >
30 Test {code}
31 </Button>
32 ))}
33 </div>
34 );
35}

Callers

nothing calls this directly

Calls 1

onClickFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…