diff --git a/frontend/src/ts/ape/adapters/ts-rest-adapter.ts b/frontend/src/ts/ape/adapters/ts-rest-adapter.ts index ded38548e..835f812ae 100644 --- a/frontend/src/ts/ape/adapters/ts-rest-adapter.ts +++ b/frontend/src/ts/ape/adapters/ts-rest-adapter.ts @@ -3,7 +3,6 @@ import { Method } from "axios"; import { getIdToken } from "firebase/auth"; import { envConfig } from "../../constants/env-config"; import { getAuthenticatedUser, isAuthenticated } from "../../firebase"; -import { EndpointMetadata } from "@monkeytype/contracts/schemas/api"; function timeoutSignal(ms: number): AbortSignal { const ctrl = new AbortController(); @@ -17,22 +16,17 @@ function buildApi(timeout: number): (args: ApiFetcherArgs) => Promise<{ headers: Headers; }> { return async (request: ApiFetcherArgs) => { - const isPublicEndpoint = - (request.route.metadata as EndpointMetadata | undefined) - ?.authenticationOptions?.isPublic ?? false; - try { const headers: HeadersInit = { ...request.headers, "X-Client-Version": envConfig.clientVersion, }; - if (!isPublicEndpoint) { - const token = isAuthenticated() - ? await getIdToken(getAuthenticatedUser()) - : ""; - headers["Authorization"] = `Bearer ${token}`; - } + const token = isAuthenticated() + ? await getIdToken(getAuthenticatedUser()) + : ""; + + headers["Authorization"] = `Bearer ${token}`; const fetchOptions: RequestInit = { method: request.method as Method, diff --git a/packages/contracts/src/admin.ts b/packages/contracts/src/admin.ts index 0d68e7e41..76595e930 100644 --- a/packages/contracts/src/admin.ts +++ b/packages/contracts/src/admin.ts @@ -58,7 +58,7 @@ export const adminContract = c.router( summary: "test permission", description: "Check for admin permission for the current user", method: "GET", - path: "/", + path: "", responses: { 200: MonkeyResponseSchema, }, diff --git a/packages/contracts/src/ape-keys.ts b/packages/contracts/src/ape-keys.ts index c5657d32c..4b6801646 100644 --- a/packages/contracts/src/ape-keys.ts +++ b/packages/contracts/src/ape-keys.ts @@ -46,7 +46,7 @@ export const apeKeysContract = c.router( summary: "get ape keys", description: "Get ape keys of the current user.", method: "GET", - path: "/", + path: "", responses: { 200: GetApeKeyResponseSchema, }, @@ -55,7 +55,7 @@ export const apeKeysContract = c.router( summary: "add ape key", description: "Add an ape key for the current user.", method: "POST", - path: "/", + path: "", body: AddApeKeyRequestSchema.strict(), responses: { 200: AddApeKeyResponseSchema, diff --git a/packages/contracts/src/configs.ts b/packages/contracts/src/configs.ts index 8790de4df..115a27d5d 100644 --- a/packages/contracts/src/configs.ts +++ b/packages/contracts/src/configs.ts @@ -22,14 +22,14 @@ export const configsContract = c.router( summary: "get config", description: "Get config of the current user.", method: "GET", - path: "/", + path: "", responses: { 200: GetConfigResponseSchema, }, }, save: { method: "PATCH", - path: "/", + path: "", body: PartialConfigSchema.strict(), responses: { 200: MonkeyResponseSchema, @@ -40,7 +40,7 @@ export const configsContract = c.router( }, delete: { method: "DELETE", - path: "/", + path: "", body: c.noBody(), responses: { 200: MonkeyResponseSchema, diff --git a/packages/contracts/src/psas.ts b/packages/contracts/src/psas.ts index 25e2f3226..a37835732 100644 --- a/packages/contracts/src/psas.ts +++ b/packages/contracts/src/psas.ts @@ -17,7 +17,7 @@ export const psasContract = c.router( summary: "get psas", description: "Get list of public service announcements", method: "GET", - path: "/", + path: "", responses: { 200: GetPsaResponseSchema, },