diff options
| author | Jan Tuomi <jans.tuomi@gmail.com> | 2022-02-07 15:47:01 +0200 |
|---|---|---|
| committer | Jan Tuomi <jans.tuomi@gmail.com> | 2022-02-07 15:47:01 +0200 |
| commit | e395c14a4159edcdb6203664e500d4adaa37bcac (patch) | |
| tree | 6190c75a1904102d1da0bd8d93b5ee6bb27108c0 | |
| parent | 63b35e0fd280dc6c4e654458a1e381e9d9dc221b (diff) | |
Fix example api details
| -rw-r--r-- | .env.production | 1 | ||||
| -rw-r--r-- | package-lock.json | 8 | ||||
| -rw-r--r-- | package.json | 2 | ||||
| -rw-r--r-- | src/api.ts | 10 |
4 files changed, 10 insertions, 11 deletions
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", @@ -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 <R, D, E>({ baseUrl, path, body }: BasePostRequest<R>, } export const useExamples = () => mapSWRResult<Example[], Error>( - useSWR("/examples", fetcher(EXAMPLE_API_URL)), + useSWR(ExampleApi.ListRequest.path, fetcher(EXAMPLE_API_URL)), ) -export type SubmitResult = APIResult<RunnerApiSubmitResponse.Body["result"], Error> +export type SubmitResult = APIResult<RunnerApi.SubmitResponse.Body["result"], Error> export const submitSource = async (text: string): Promise<SubmitResult> => { - const apiResult = await postRequest<RunnerApiSubmitRequest.Body, RunnerApiSubmitResponse.Body, Error>( + const apiResult = await postRequest<RunnerApi.SubmitRequest.Body, RunnerApi.SubmitResponse.Body, Error>( { baseUrl: RUNNER_API_URL, - path: RunnerApiSubmitRequest.path, + path: RunnerApi.SubmitRequest.path, body: { source: text, }, |
