MCPcopy Create free account
hub / github.com/Noumena-Network/code / ApproveApiKey

Function ApproveApiKey

src/components/ApproveApiKey.tsx:12–126  ·  view source on GitHub ↗
(t0)

Source from the content-addressed store, hash-verified

10 onDone(approved: boolean): void;
11};
12export function ApproveApiKey(t0) {
13 const $ = _c(19);
14 const {
15 customApiKeyTruncated,
16 envVarName = 'NOUMENA_API_KEY',
17 onDone
18 } = t0;
19 let t1;
20 if ($[0] !== customApiKeyTruncated || $[1] !== onDone) {
21 t1 = function onChange(value) {
22 bb2: switch (value) {
23 case "yes":
24 {
25 saveGlobalConfig(current_0 => ({
26 ...current_0,
27 customApiKeyResponses: {
28 ...current_0.customApiKeyResponses,
29 approved: [...(current_0.customApiKeyResponses?.approved ?? []), customApiKeyTruncated]
30 }
31 }));
32 onDone(true);
33 break bb2;
34 }
35 case "no":
36 {
37 saveGlobalConfig(current => ({
38 ...current,
39 customApiKeyResponses: {
40 ...current.customApiKeyResponses,
41 rejected: [...(current.customApiKeyResponses?.rejected ?? []), customApiKeyTruncated]
42 }
43 }));
44 onDone(false);
45 }
46 }
47 };
48 $[0] = customApiKeyTruncated;
49 $[1] = onDone;
50 $[2] = t1;
51 } else {
52 t1 = $[2];
53 }
54 const onChange = t1;
55 let t2;
56 if ($[3] !== onChange) {
57 t2 = () => onChange("no");
58 $[3] = onChange;
59 $[4] = t2;
60 } else {
61 t2 = $[4];
62 }
63 let t3;
64 if ($[5] !== envVarName) {
65 t3 = <Text bold={true}>{envVarName}</Text>;
66 $[5] = envVarName;
67 $[6] = t3;
68 } else {
69 t3 = $[6];

Callers

nothing calls this directly

Calls 3

saveGlobalConfigFunction · 0.70
onDoneFunction · 0.50
onChangeFunction · 0.50

Tested by

no test coverage detected