Create send function for API requests

This commit is contained in:
venashial
2022-06-25 00:17:42 -07:00
parent 2e6e1f4060
commit aec03294d6
10 changed files with 172 additions and 23 deletions

4
docs/dummyStore.ts Normal file
View File

@@ -0,0 +1,4 @@
import { writable } from 'svelte/store'
// Used in `src/utils/send.ts`
export const token = writable('')

View File

@@ -2,6 +2,24 @@
title: Built-in utilities
---
## API requests
Use the `send` function to make API requests.
```svelte example raised
<script lang="ts">
import { send } from 'omorphia/utils'
const project = send<'getProject'>('GET', 'project/sodium')
</script>
{#await project}
fetching...
{:then project}
{project.downloads} downloads
{/await}
```
## Markdown
Use the markdown utilities to parse markdown text into HTML. Both markdown parsers have HTML sanitization built-in.