refactor: initial frontend wiring for new api

This commit is contained in:
2025-12-15 00:13:10 +00:00
parent 528aa943fa
commit 05edf69ca7
63 changed files with 1876 additions and 1991 deletions

View File

@@ -0,0 +1,14 @@
import { queryOptions } from "@tanstack/react-query"
import { atomWithQuery } from "jotai-tanstack-query"
import { fetchApi } from "../lib/api"
import { User } from "./user"
export const currentUserQuery = queryOptions({
queryKey: ["currentUser"],
queryFn: async () =>
fetchApi("GET", "/users/me", {
returns: User,
}).then(([_, result]) => result),
})
export const currentUserAtom = atomWithQuery(() => currentUserQuery)

View File

@@ -0,0 +1,9 @@
import { type } from "arktype"
export const User = type({
id: "string",
displayName: "string",
email: "string",
})
export type User = typeof User.infer