aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/Editor.tsx4
-rw-r--r--src/api.ts8
2 files changed, 4 insertions, 8 deletions
diff --git a/src/Editor.tsx b/src/Editor.tsx
index 2fff5b9..b0441d7 100644
--- a/src/Editor.tsx
+++ b/src/Editor.tsx
@@ -35,7 +35,9 @@ const Editor = () => {
An unexpected error occurred while loading examples. See console for details.
</div>
case "success": {
- const options = examples.data.map(example => ({ value: example.content, label: example.title }))
+ const options = examples.data.examples.map(example => ({
+ value: example.content, label: example.title,
+ }))
const customStyles = {
option: (styles: any) => ({
...styles,
diff --git a/src/api.ts b/src/api.ts
index c486acc..226e213 100644
--- a/src/api.ts
+++ b/src/api.ts
@@ -12,12 +12,6 @@ const fetcher = (baseUrl: string) => (path: string) => fetch(`${baseUrl}${path}`
throw err
})
-interface Example {
- id: string
- title: string
- content: string
-}
-
export interface APISuccess<D> {
readonly type: "success"
data: D
@@ -77,7 +71,7 @@ const postRequest = async <R, D, E>({ baseUrl, path, body }: BasePostRequest<R>,
}
}
-export const useExamples = () => mapSWRResult<Example[], Error>(
+export const useExamples = () => mapSWRResult<ExampleApi.ListResponse.Body, Error>(
useSWR(ExampleApi.ListRequest.path, fetcher(EXAMPLE_API_URL)),
)