diff --git a/.playwright-mcp/browse-page.png b/.playwright-mcp/browse-page.png new file mode 100644 index 00000000..7e21a48b Binary files /dev/null and b/.playwright-mcp/browse-page.png differ diff --git a/.playwright-mcp/rooms-page.png b/.playwright-mcp/rooms-page.png new file mode 100644 index 00000000..90adf5f1 Binary files /dev/null and b/.playwright-mcp/rooms-page.png differ diff --git a/www/app/(app)/AuthWrapper.tsx b/www/app/(app)/AuthWrapper.tsx index 8af78f81..cdd85cca 100644 --- a/www/app/(app)/AuthWrapper.tsx +++ b/www/app/(app)/AuthWrapper.tsx @@ -19,7 +19,7 @@ export default function AuthWrapper({ justifyContent="center" h="calc(100vh - 80px)" // Account for header height > - + ); } diff --git a/www/app/(app)/browse/_components/FilterSidebar.tsx b/www/app/(app)/browse/_components/FilterSidebar.tsx index 17b4e7e9..48c79fdc 100644 --- a/www/app/(app)/browse/_components/FilterSidebar.tsx +++ b/www/app/(app)/browse/_components/FilterSidebar.tsx @@ -1,7 +1,10 @@ import React from "react"; import { Box, Stack, Link, Heading } from "@chakra-ui/react"; import NextLink from "next/link"; -import { Room, SourceKind } from "../../../lib/api-types"; +import type { components } from "../../../reflector-api"; + +type Room = components["schemas"]["Room"]; +type SourceKind = components["schemas"]["SourceKind"]; interface FilterSidebarProps { rooms: Room[]; diff --git a/www/app/(app)/browse/_components/TranscriptCards.tsx b/www/app/(app)/browse/_components/TranscriptCards.tsx index f417ccc8..8dbc3568 100644 --- a/www/app/(app)/browse/_components/TranscriptCards.tsx +++ b/www/app/(app)/browse/_components/TranscriptCards.tsx @@ -18,7 +18,10 @@ import { highlightMatches, generateTextFragment, } from "../../../lib/textHighlight"; -import { SearchResult, SourceKind } from "../../../lib/api-types"; +import type { components } from "../../../reflector-api"; + +type SearchResult = components["schemas"]["SearchResult"]; +type SourceKind = components["schemas"]["SourceKind"]; interface TranscriptCardsProps { results: SearchResult[]; diff --git a/www/app/(app)/browse/page.tsx b/www/app/(app)/browse/page.tsx index 28ef9b30..b82b537a 100644 --- a/www/app/(app)/browse/page.tsx +++ b/www/app/(app)/browse/page.tsx @@ -20,12 +20,11 @@ import { } from "nuqs"; import { LuX } from "react-icons/lu"; import useSessionUser from "../../lib/useSessionUser"; -import { - Room, - SourceKind, - SearchResult, - $SourceKind, -} from "../../lib/api-types"; +import type { components } from "../../reflector-api"; + +type Room = components["schemas"]["Room"]; +type SourceKind = components["schemas"]["SourceKind"]; +type SearchResult = components["schemas"]["SearchResult"]; import { useRoomsList, useTranscriptsSearch, @@ -204,7 +203,7 @@ export default function TranscriptBrowser() { const [urlSourceKind, setUrlSourceKind] = useQueryState( "source", - parseAsStringLiteral($SourceKind.values).withOptions({ + parseAsStringLiteral(["room", "live", "file"] as const).withOptions({ shallow: false, }), ); diff --git a/www/app/(app)/rooms/_components/RoomCards.tsx b/www/app/(app)/rooms/_components/RoomCards.tsx index dafc08da..8b22ad72 100644 --- a/www/app/(app)/rooms/_components/RoomCards.tsx +++ b/www/app/(app)/rooms/_components/RoomCards.tsx @@ -12,7 +12,9 @@ import { HStack, } from "@chakra-ui/react"; import { LuLink } from "react-icons/lu"; -import { Room } from "../../../lib/api-types"; +import type { components } from "../../../reflector-api"; + +type Room = components["schemas"]["Room"]; import { RoomActionsMenu } from "./RoomActionsMenu"; interface RoomCardsProps { diff --git a/www/app/(app)/rooms/_components/RoomList.tsx b/www/app/(app)/rooms/_components/RoomList.tsx index ed0b6014..218c890c 100644 --- a/www/app/(app)/rooms/_components/RoomList.tsx +++ b/www/app/(app)/rooms/_components/RoomList.tsx @@ -1,5 +1,7 @@ import { Box, Heading, Text, VStack } from "@chakra-ui/react"; -import { Room } from "../../../lib/api-types"; +import type { components } from "../../../reflector-api"; + +type Room = components["schemas"]["Room"]; import { RoomTable } from "./RoomTable"; import { RoomCards } from "./RoomCards"; diff --git a/www/app/(app)/rooms/_components/RoomTable.tsx b/www/app/(app)/rooms/_components/RoomTable.tsx index 31c335a6..113eca7f 100644 --- a/www/app/(app)/rooms/_components/RoomTable.tsx +++ b/www/app/(app)/rooms/_components/RoomTable.tsx @@ -9,7 +9,9 @@ import { Spinner, } from "@chakra-ui/react"; import { LuLink } from "react-icons/lu"; -import { Room } from "../../../lib/api-types"; +import type { components } from "../../../reflector-api"; + +type Room = components["schemas"]["Room"]; import { RoomActionsMenu } from "./RoomActionsMenu"; interface RoomTableProps { diff --git a/www/app/(app)/rooms/page.tsx b/www/app/(app)/rooms/page.tsx index e4c72aa6..bb48126a 100644 --- a/www/app/(app)/rooms/page.tsx +++ b/www/app/(app)/rooms/page.tsx @@ -16,7 +16,7 @@ import { } from "@chakra-ui/react"; import { useEffect, useState } from "react"; import useRoomList from "./useRoomList"; -import { Room } from "../../lib/api-types"; +import type { components } from "../../reflector-api"; import { useRoomCreate, useRoomUpdate, @@ -27,6 +27,8 @@ import { import { RoomList } from "./_components/RoomList"; import { PaginationPage } from "../browse/_components/Pagination"; +type Room = components["schemas"]["Room"]; + interface SelectOption { label: string; value: string; diff --git a/www/app/(app)/rooms/useRoomList.tsx b/www/app/(app)/rooms/useRoomList.tsx index aad01939..a2188e54 100644 --- a/www/app/(app)/rooms/useRoomList.tsx +++ b/www/app/(app)/rooms/useRoomList.tsx @@ -1,5 +1,7 @@ import { useRoomsList } from "../../lib/api-hooks"; -import { Page_Room_ } from "../../lib/api-types"; +import type { components } from "../../reflector-api"; + +type Page_Room_ = components["schemas"]["Page_Room_"]; import { PaginationPage } from "../browse/_components/Pagination"; type RoomList = { diff --git a/www/app/(app)/transcripts/[transcriptId]/correct/page.tsx b/www/app/(app)/transcripts/[transcriptId]/correct/page.tsx index 839a48cc..47d86aa1 100644 --- a/www/app/(app)/transcripts/[transcriptId]/correct/page.tsx +++ b/www/app/(app)/transcripts/[transcriptId]/correct/page.tsx @@ -6,7 +6,8 @@ import TopicPlayer from "./topicPlayer"; import useParticipants from "../../useParticipants"; import useTopicWithWords from "../../useTopicWithWords"; import ParticipantList from "./participantList"; -import { GetTranscriptTopic } from "../../../../lib/api-types"; +import type { components } from "../../../../reflector-api"; +type GetTranscriptTopic = components["schemas"]["GetTranscriptTopic"]; import { SelectedText, selectedTextIsTimeSlice } from "./types"; import { useTranscriptUpdate } from "../../../../lib/api-hooks"; import useTranscript from "../../useTranscript"; diff --git a/www/app/(app)/transcripts/[transcriptId]/correct/participantList.tsx b/www/app/(app)/transcripts/[transcriptId]/correct/participantList.tsx index 5cef29f9..f58819c8 100644 --- a/www/app/(app)/transcripts/[transcriptId]/correct/participantList.tsx +++ b/www/app/(app)/transcripts/[transcriptId]/correct/participantList.tsx @@ -1,7 +1,8 @@ import { faArrowTurnDown } from "@fortawesome/free-solid-svg-icons"; import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; import { ChangeEvent, useEffect, useRef, useState } from "react"; -import { Participant } from "../../../../lib/api-types"; +import type { components } from "../../../../reflector-api"; +type Participant = components["schemas"]["Participant"]; import { useTranscriptSpeakerAssign, useTranscriptSpeakerMerge, diff --git a/www/app/(app)/transcripts/[transcriptId]/correct/topicHeader.tsx b/www/app/(app)/transcripts/[transcriptId]/correct/topicHeader.tsx index 3bd3a1cc..494d2929 100644 --- a/www/app/(app)/transcripts/[transcriptId]/correct/topicHeader.tsx +++ b/www/app/(app)/transcripts/[transcriptId]/correct/topicHeader.tsx @@ -1,6 +1,7 @@ import useTopics from "../../useTopics"; import { Dispatch, SetStateAction, useEffect } from "react"; -import { GetTranscriptTopic } from "../../../../lib/api-types"; +import type { components } from "../../../../reflector-api"; +type GetTranscriptTopic = components["schemas"]["GetTranscriptTopic"]; import { BoxProps, Box, diff --git a/www/app/(app)/transcripts/[transcriptId]/finalSummary.tsx b/www/app/(app)/transcripts/[transcriptId]/finalSummary.tsx index b59b5bf1..04960945 100644 --- a/www/app/(app)/transcripts/[transcriptId]/finalSummary.tsx +++ b/www/app/(app)/transcripts/[transcriptId]/finalSummary.tsx @@ -2,7 +2,9 @@ import { useEffect, useRef, useState } from "react"; import React from "react"; import Markdown from "react-markdown"; import "../../../styles/markdown.css"; -import { GetTranscript, GetTranscriptTopic } from "../../../lib/api-types"; +import type { components } from "../../../reflector-api"; +type GetTranscript = components["schemas"]["GetTranscript"]; +type GetTranscriptTopic = components["schemas"]["GetTranscriptTopic"]; import { useTranscriptUpdate } from "../../../lib/api-hooks"; import { Flex, diff --git a/www/app/(app)/transcripts/createTranscript.ts b/www/app/(app)/transcripts/createTranscript.ts index 1b57f870..7f21d227 100644 --- a/www/app/(app)/transcripts/createTranscript.ts +++ b/www/app/(app)/transcripts/createTranscript.ts @@ -1,6 +1,9 @@ -import { CreateTranscript, GetTranscript } from "../../lib/api-types"; +import type { components } from "../../reflector-api"; import { useTranscriptCreate } from "../../lib/api-hooks"; +type CreateTranscript = components["schemas"]["CreateTranscript"]; +type GetTranscript = components["schemas"]["GetTranscript"]; + type UseCreateTranscript = { transcript: GetTranscript | null; loading: boolean; diff --git a/www/app/(app)/transcripts/player.tsx b/www/app/(app)/transcripts/player.tsx index b9cb1020..4e1c0a7c 100644 --- a/www/app/(app)/transcripts/player.tsx +++ b/www/app/(app)/transcripts/player.tsx @@ -5,7 +5,9 @@ import RegionsPlugin from "wavesurfer.js/dist/plugins/regions.esm.js"; import { formatTime, formatTimeMs } from "../../lib/time"; import { Topic } from "./webSocketTypes"; -import { AudioWaveform } from "../../lib/api-types"; +import type { components } from "../../reflector-api"; + +type AudioWaveform = components["schemas"]["AudioWaveform"]; import { waveSurferStyles } from "../../styles/recorder"; import { Box, Flex, IconButton } from "@chakra-ui/react"; import { LuPause, LuPlay } from "react-icons/lu"; diff --git a/www/app/(app)/transcripts/shareAndPrivacy.tsx b/www/app/(app)/transcripts/shareAndPrivacy.tsx index b9102472..3dbd71c9 100644 --- a/www/app/(app)/transcripts/shareAndPrivacy.tsx +++ b/www/app/(app)/transcripts/shareAndPrivacy.tsx @@ -2,11 +2,10 @@ import { useEffect, useState } from "react"; import { featureEnabled } from "../../domainContext"; import { ShareMode, toShareMode } from "../../lib/shareMode"; -import { - GetTranscript, - GetTranscriptTopic, - UpdateTranscript, -} from "../../lib/api-types"; +import type { components } from "../../reflector-api"; +type GetTranscript = components["schemas"]["GetTranscript"]; +type GetTranscriptTopic = components["schemas"]["GetTranscriptTopic"]; +type UpdateTranscript = components["schemas"]["UpdateTranscript"]; import { Box, Flex, diff --git a/www/app/(app)/transcripts/shareCopy.tsx b/www/app/(app)/transcripts/shareCopy.tsx index 5715fcfc..dd56f213 100644 --- a/www/app/(app)/transcripts/shareCopy.tsx +++ b/www/app/(app)/transcripts/shareCopy.tsx @@ -1,5 +1,7 @@ import { useState } from "react"; -import { GetTranscript, GetTranscriptTopic } from "../../lib/api-types"; +import type { components } from "../../reflector-api"; +type GetTranscript = components["schemas"]["GetTranscript"]; +type GetTranscriptTopic = components["schemas"]["GetTranscriptTopic"]; import { Button, BoxProps, Box } from "@chakra-ui/react"; type ShareCopyProps = { diff --git a/www/app/(app)/transcripts/shareZulip.tsx b/www/app/(app)/transcripts/shareZulip.tsx index 7108afb4..d36041c3 100644 --- a/www/app/(app)/transcripts/shareZulip.tsx +++ b/www/app/(app)/transcripts/shareZulip.tsx @@ -1,6 +1,9 @@ import { useState, useEffect, useMemo } from "react"; import { featureEnabled } from "../../domainContext"; -import { GetTranscript, GetTranscriptTopic } from "../../lib/api-types"; +import type { components } from "../../reflector-api"; + +type GetTranscript = components["schemas"]["GetTranscript"]; +type GetTranscriptTopic = components["schemas"]["GetTranscriptTopic"]; import { BoxProps, Button, diff --git a/www/app/(app)/transcripts/transcriptTitle.tsx b/www/app/(app)/transcripts/transcriptTitle.tsx index 4a8468b3..6901196a 100644 --- a/www/app/(app)/transcripts/transcriptTitle.tsx +++ b/www/app/(app)/transcripts/transcriptTitle.tsx @@ -1,5 +1,7 @@ import { useState } from "react"; -import { UpdateTranscript } from "../../lib/api-types"; +import type { components } from "../../reflector-api"; + +type UpdateTranscript = components["schemas"]["UpdateTranscript"]; import { useTranscriptUpdate } from "../../lib/api-hooks"; import { Heading, IconButton, Input, Flex, Spacer } from "@chakra-ui/react"; import { LuPen } from "react-icons/lu"; diff --git a/www/app/(app)/transcripts/useParticipants.ts b/www/app/(app)/transcripts/useParticipants.ts index 014a0cf1..875d9fcc 100644 --- a/www/app/(app)/transcripts/useParticipants.ts +++ b/www/app/(app)/transcripts/useParticipants.ts @@ -1,4 +1,5 @@ -import { Participant } from "../../lib/api-types"; +import type { components } from "../../reflector-api"; +type Participant = components["schemas"]["Participant"]; import { useTranscriptParticipants } from "../../lib/api-hooks"; type ErrorParticipants = { diff --git a/www/app/(app)/transcripts/useSearchTranscripts.ts b/www/app/(app)/transcripts/useSearchTranscripts.ts index 04784dc3..dd1eb3ae 100644 --- a/www/app/(app)/transcripts/useSearchTranscripts.ts +++ b/www/app/(app)/transcripts/useSearchTranscripts.ts @@ -1,5 +1,7 @@ // Wrapper for backward compatibility -import { SearchResult, SourceKind } from "../../lib/api-types"; +import type { components } from "../../reflector-api"; +type SearchResult = components["schemas"]["SearchResult"]; +type SourceKind = components["schemas"]["SourceKind"]; import { useTranscriptsSearch } from "../../lib/api-hooks"; import { PaginationPage, diff --git a/www/app/(app)/transcripts/useTopicWithWords.ts b/www/app/(app)/transcripts/useTopicWithWords.ts index 4fc10269..e3793d22 100644 --- a/www/app/(app)/transcripts/useTopicWithWords.ts +++ b/www/app/(app)/transcripts/useTopicWithWords.ts @@ -1,6 +1,9 @@ -import { GetTranscriptTopicWithWordsPerSpeaker } from "../../lib/api-types"; +import type { components } from "../../reflector-api"; import { useTranscriptTopicsWithWordsPerSpeaker } from "../../lib/api-hooks"; +type GetTranscriptTopicWithWordsPerSpeaker = + components["schemas"]["GetTranscriptTopicWithWordsPerSpeaker"]; + type ErrorTopicWithWords = { error: Error; loading: false; diff --git a/www/app/(app)/transcripts/useTopics.ts b/www/app/(app)/transcripts/useTopics.ts index b2923cba..8d490a5e 100644 --- a/www/app/(app)/transcripts/useTopics.ts +++ b/www/app/(app)/transcripts/useTopics.ts @@ -1,5 +1,7 @@ import { useTranscriptTopics } from "../../lib/api-hooks"; -import { GetTranscriptTopic } from "../../lib/api-types"; +import type { components } from "../../reflector-api"; + +type GetTranscriptTopic = components["schemas"]["GetTranscriptTopic"]; type TranscriptTopics = { topics: GetTranscriptTopic[] | null; diff --git a/www/app/(app)/transcripts/useTranscript.ts b/www/app/(app)/transcripts/useTranscript.ts index 7872bd09..9c9a25fd 100644 --- a/www/app/(app)/transcripts/useTranscript.ts +++ b/www/app/(app)/transcripts/useTranscript.ts @@ -1,6 +1,8 @@ -import { GetTranscript } from "../../lib/api-types"; +import type { components } from "../../reflector-api"; import { useTranscriptGet } from "../../lib/api-hooks"; +type GetTranscript = components["schemas"]["GetTranscript"]; + type ErrorTranscript = { error: Error; loading: false; diff --git a/www/app/(app)/transcripts/useWaveform.ts b/www/app/(app)/transcripts/useWaveform.ts index aca86816..800abca4 100644 --- a/www/app/(app)/transcripts/useWaveform.ts +++ b/www/app/(app)/transcripts/useWaveform.ts @@ -1,6 +1,8 @@ -import { AudioWaveform } from "../../lib/api-types"; +import type { components } from "../../reflector-api"; import { useTranscriptWaveform } from "../../lib/api-hooks"; +type AudioWaveform = components["schemas"]["AudioWaveform"]; + type AudioWaveFormResponse = { waveform: AudioWaveform | null; loading: boolean; diff --git a/www/app/(app)/transcripts/useWebRTC.ts b/www/app/(app)/transcripts/useWebRTC.ts index 2ae8cbce..48972f41 100644 --- a/www/app/(app)/transcripts/useWebRTC.ts +++ b/www/app/(app)/transcripts/useWebRTC.ts @@ -2,7 +2,8 @@ import { useEffect, useState } from "react"; import Peer from "simple-peer"; import { useError } from "../../(errors)/errorContext"; import { useTranscriptWebRTC } from "../../lib/api-hooks"; -import { RtcOffer } from "../../lib/api-types"; +import type { components } from "../../reflector-api"; +type RtcOffer = components["schemas"]["RtcOffer"]; const useWebRTC = ( stream: MediaStream | null, diff --git a/www/app/(app)/transcripts/useWebSockets.ts b/www/app/(app)/transcripts/useWebSockets.ts index 69e0836d..736362ed 100644 --- a/www/app/(app)/transcripts/useWebSockets.ts +++ b/www/app/(app)/transcripts/useWebSockets.ts @@ -2,7 +2,10 @@ import { useContext, useEffect, useState } from "react"; import { Topic, FinalSummary, Status } from "./webSocketTypes"; import { useError } from "../../(errors)/errorContext"; import { DomainContext } from "../../domainContext"; -import { AudioWaveform, GetTranscriptSegmentTopic } from "../../lib/api-types"; +import type { components } from "../../reflector-api"; +type AudioWaveform = components["schemas"]["AudioWaveform"]; +type GetTranscriptSegmentTopic = + components["schemas"]["GetTranscriptSegmentTopic"]; import { useQueryClient } from "@tanstack/react-query"; import { $api } from "../../lib/apiClient"; diff --git a/www/app/(app)/transcripts/webSocketTypes.ts b/www/app/(app)/transcripts/webSocketTypes.ts index 4973ea2e..4ec98946 100644 --- a/www/app/(app)/transcripts/webSocketTypes.ts +++ b/www/app/(app)/transcripts/webSocketTypes.ts @@ -1,4 +1,6 @@ -import { GetTranscriptTopic } from "../../lib/api-types"; +import type { components } from "../../reflector-api"; + +type GetTranscriptTopic = components["schemas"]["GetTranscriptTopic"]; export type Topic = GetTranscriptTopic; diff --git a/www/app/[roomName]/page.tsx b/www/app/[roomName]/page.tsx index ec65f43c..51098a33 100644 --- a/www/app/[roomName]/page.tsx +++ b/www/app/[roomName]/page.tsx @@ -24,7 +24,9 @@ import { notFound } from "next/navigation"; import useSessionStatus from "../lib/useSessionStatus"; import { useRecordingConsent } from "../recordingConsentContext"; import { useMeetingAudioConsent } from "../lib/api-hooks"; -import { Meeting } from "../lib/api-types"; +import type { components } from "../reflector-api"; + +type Meeting = components["schemas"]["Meeting"]; import { FaBars } from "react-icons/fa6"; export type RoomDetails = { diff --git a/www/app/[roomName]/useRoomMeeting.tsx b/www/app/[roomName]/useRoomMeeting.tsx index d8a308c1..a3532a93 100644 --- a/www/app/[roomName]/useRoomMeeting.tsx +++ b/www/app/[roomName]/useRoomMeeting.tsx @@ -1,7 +1,9 @@ import { useEffect, useState } from "react"; import { useError } from "../(errors)/errorContext"; -import { Meeting } from "../lib/api-types"; +import type { components } from "../reflector-api"; import { shouldShowError } from "../lib/errorUtils"; + +type Meeting = components["schemas"]["Meeting"]; import { useRoomsCreateMeeting } from "../lib/api-hooks"; import { notFound } from "next/navigation"; diff --git a/www/app/lib/ApiAuthProvider.tsx b/www/app/lib/ApiAuthProvider.tsx index fd8bdc96..ae1701d2 100644 --- a/www/app/lib/ApiAuthProvider.tsx +++ b/www/app/lib/ApiAuthProvider.tsx @@ -4,13 +4,10 @@ import { useEffect } from "react"; import { configureApiAuth } from "./apiClient"; import useSessionAccessToken from "./useSessionAccessToken"; -// Note: Base URL is now configured directly in apiClient.tsx - export function ApiAuthProvider({ children }: { children: React.ReactNode }) { const { accessToken } = useSessionAccessToken(); useEffect(() => { - // Configure authentication configureApiAuth(accessToken); }, [accessToken]); diff --git a/www/app/lib/api-types.ts b/www/app/lib/api-types.ts deleted file mode 100644 index 66aed1c7..00000000 --- a/www/app/lib/api-types.ts +++ /dev/null @@ -1,27 +0,0 @@ -// Re-export types from generated OpenAPI schema for backward compatibility -import type { components } from "../reflector-api"; - -// Export types with their original names -export type Room = components["schemas"]["Room"]; -export type Meeting = components["schemas"]["Meeting"]; -export type SourceKind = components["schemas"]["SourceKind"]; -export type SearchResult = components["schemas"]["SearchResult"]; -export type GetTranscript = components["schemas"]["GetTranscript"]; -export type GetTranscriptTopic = components["schemas"]["GetTranscriptTopic"]; -export type UpdateTranscript = components["schemas"]["UpdateTranscript"]; -export type AudioWaveform = components["schemas"]["AudioWaveform"]; -export type Participant = components["schemas"]["Participant"]; -export type CreateTranscript = components["schemas"]["CreateTranscript"]; -export type RtcOffer = components["schemas"]["RtcOffer"]; -export type GetTranscriptSegmentTopic = - components["schemas"]["GetTranscriptSegmentTopic"]; -export type Page_Room_ = components["schemas"]["Page_Room_"]; -export type GetTranscriptTopicWithWordsPerSpeaker = - components["schemas"]["GetTranscriptTopicWithWordsPerSpeaker"]; -export type GetTranscriptMinimal = - components["schemas"]["GetTranscriptMinimal"]; - -// Export any enums or constants that were in the old API -export const $SourceKind = { - values: ["room", "live", "file"] as const, -} as const; diff --git a/www/app/lib/apiClient.tsx b/www/app/lib/apiClient.tsx index 118adcd1..5c5b2ca2 100644 --- a/www/app/lib/apiClient.tsx +++ b/www/app/lib/apiClient.tsx @@ -16,23 +16,21 @@ export const client = createClient({ baseUrl: "http://127.0.0.1:1250", }); -// Create the React Query client wrapper export const $api = createFetchClient(client); -// Store the current auth token and ready state let currentAuthToken: string | null | undefined = null; let authConfigured = false; -// Export function to check if auth is ready export const isAuthConfigured = () => authConfigured; -// Set up authentication middleware once client.use({ onRequest({ request }) { if (currentAuthToken) { request.headers.set("Authorization", `Bearer ${currentAuthToken}`); } - // Only set Content-Type if not already set (FormData will set its own boundary) + // XXX Only set Content-Type if not already set (FormData will set its own boundary) + // This is a work around for uploading file, we're passing a formdata + // but the content type was still application/json if ( !request.headers.has("Content-Type") && !(request.body instanceof FormData) @@ -43,13 +41,11 @@ client.use({ }, }); -// Configure authentication by updating the token export const configureApiAuth = (token: string | null | undefined) => { currentAuthToken = token; authConfigured = true; }; -// Export typed hooks for convenience export const useApiQuery = $api.useQuery; export const useApiMutation = $api.useMutation; export const useApiSuspenseQuery = $api.useSuspenseQuery;