From e395c14a4159edcdb6203664e500d4adaa37bcac Mon Sep 17 00:00:00 2001 From: Jan Tuomi Date: Mon, 7 Feb 2022 15:47:01 +0200 Subject: Fix example api details --- src/api.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/api.ts b/src/api.ts index 7ac283b..c486acc 100644 --- a/src/api.ts +++ b/src/api.ts @@ -1,5 +1,5 @@ import useSWR, { SWRResponse } from "swr" -import { RunnerApiSubmitRequest, RunnerApiSubmitResponse } from "slam-types" +import { RunnerApi, ExampleApi } from "slam-types" const RUNNER_API_URL = String(import.meta.env.VITE_RUNNER_API_URL) const EXAMPLE_API_URL = String(import.meta.env.VITE_EXAMPLE_API_URL) @@ -78,16 +78,16 @@ const postRequest = async ({ baseUrl, path, body }: BasePostRequest, } export const useExamples = () => mapSWRResult( - useSWR("/examples", fetcher(EXAMPLE_API_URL)), + useSWR(ExampleApi.ListRequest.path, fetcher(EXAMPLE_API_URL)), ) -export type SubmitResult = APIResult +export type SubmitResult = APIResult export const submitSource = async (text: string): Promise => { - const apiResult = await postRequest( + const apiResult = await postRequest( { baseUrl: RUNNER_API_URL, - path: RunnerApiSubmitRequest.path, + path: RunnerApi.SubmitRequest.path, body: { source: text, }, -- cgit v1.3