History

refactor(cloud): simplify authAtom type annotation

Rhys Sullivan committed 7 months ago

Commit aa604e21 parent 9d648ec1 file · +2 −7Browse files

Unified · Split

apps/cloud/src/web/auth.tsx+2−7
@@ -1,5 +1,5 @@
11 import React, { createContext, useContext } from "react";
2−import { Atom, useAtomValue, Result } from "@effect-atom/atom-react";
2+import { useAtomValue, Result } from "@effect-atom/atom-react";
33
44 import { CloudApiClient } from "./client";
55
@@ -19,16 +19,11 @@ type AuthTeam = { · 13 unmodified lines
1919 name: string;
2020 };
2121
22−type MeResponse = {
23− user: AuthUser;
24− team: AuthTeam | null;
25−};
26−
2722 // ---------------------------------------------------------------------------
2823 // Auth atom — typed query against CloudAuthApi
2924 // ---------------------------------------------------------------------------
3025
31−export const authAtom: Atom.Atom<Result.Result<MeResponse, unknown>> =
26+export const authAtom: ReturnType<typeof CloudApiClient.query<"cloudAuth", "me">> =
3227 CloudApiClient.query("cloudAuth", "me", {
3328 timeToLive: "5 minutes",
3429 });

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t