MCPcopy Index your code
hub / github.com/code-with-antonio/nightcode / fetchSession

Function fetchSession

packages/cli/src/screens/session.tsx:136–153  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

134
135 let ignore = false;
136 const fetchSession = async () => {
137 try {
138 const res = await apiClient.sessions[":id"].$get({
139 param: { id },
140 });
141 if (ignore) return;
142 if (!res.ok) throw new Error(await getErrorMessage(res));
143 const resolved = await res.json();
144 setSession(resolved);
145 } catch (err) {
146 if (ignore) return;
147 toast.show({
148 variant: "error",
149 message: err instanceof Error ? err.message : "Failed to load session",
150 });
151 navigate("/", { replace: true });
152 }
153 };
154
155 fetchSession();
156 return () => {

Callers 1

SessionFunction · 0.85

Calls 1

getErrorMessageFunction · 0.90

Tested by

no test coverage detected