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 --- .env.production | 1 - package-lock.json | 8 ++++---- package.json | 2 +- src/api.ts | 10 +++++----- 4 files changed, 10 insertions(+), 11 deletions(-) delete mode 100644 .env.production diff --git a/.env.production b/.env.production deleted file mode 100644 index a7b2481..0000000 --- a/.env.production +++ /dev/null @@ -1 +0,0 @@ -VITE_RUNNER_API_URL=https://slam-lang-runner-api-6hdcd6nxsq-ew.a.run.app diff --git a/package-lock.json b/package-lock.json index eb254d1..8ff27ff 100644 --- a/package-lock.json +++ b/package-lock.json @@ -23,7 +23,7 @@ "@vitejs/plugin-react": "^1.0.7", "eslint": "8.8.0", "eslint-plugin-react": "7.28.0", - "slam-types": "git://github.com/jantuomi/slam-types.git#a401431", + "slam-types": "git://github.com/jantuomi/slam-types.git#441a72c", "typescript": "^4.4.4", "vite": "^2.7.2" } @@ -3341,7 +3341,7 @@ }, "node_modules/slam-types": { "version": "1.0.0", - "resolved": "git+ssh://git@github.com/jantuomi/slam-types.git#a401431df444d5e1f8c4367226969ca7930b1991", + "resolved": "git+ssh://git@github.com/jantuomi/slam-types.git#441a72c04cfc61dfead5cad37202a1da87a44499", "dev": true, "license": "ISC" }, @@ -6052,9 +6052,9 @@ } }, "slam-types": { - "version": "git+ssh://git@github.com/jantuomi/slam-types.git#a401431df444d5e1f8c4367226969ca7930b1991", + "version": "git+ssh://git@github.com/jantuomi/slam-types.git#441a72c04cfc61dfead5cad37202a1da87a44499", "dev": true, - "from": "slam-types@git://github.com/jantuomi/slam-types.git#a401431" + "from": "slam-types@git://github.com/jantuomi/slam-types.git#441a72c" }, "slash": { "version": "3.0.0", diff --git a/package.json b/package.json index a1981f9..c5e222c 100644 --- a/package.json +++ b/package.json @@ -15,7 +15,7 @@ "swr": "1.2.1" }, "devDependencies": { - "slam-types": "git://github.com/jantuomi/slam-types.git#a401431", + "slam-types": "git://github.com/jantuomi/slam-types.git#441a72c", "@types/react": "^17.0.33", "@types/react-dom": "^17.0.10", "@typescript-eslint/eslint-plugin": "5.10.2", 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