diff options
| author | secondl1ght <[email protected]> | 2022-07-27 00:04:37 -0600 |
|---|---|---|
| committer | secondl1ght <[email protected]> | 2022-07-27 00:04:37 -0600 |
| commit | 1387dc5e4e69682749446f2e9b8717f96947328c (patch) | |
| tree | 5bd966261283f7cffd3926609b1174c74be8c8b6 /src/lib/utils.js | |
| parent | 80cf7e9b77dcc4cbcf7711eb63a218c3aec07ec6 (diff) | |
| parent | 059613490db9be904791686c49851ec1cc095774 (diff) | |
| download | coinos-ui-1387dc5e4e69682749446f2e9b8717f96947328c.tar.gz coinos-ui-1387dc5e4e69682749446f2e9b8717f96947328c.zip | |
Merge branch 'master' of github.com:coinos/coinos-ui-v2
Diffstat (limited to 'src/lib/utils.js')
| -rw-r--r-- | src/lib/utils.js | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/lib/utils.js b/src/lib/utils.js index ba0d8335..b1bc24ec 100644 --- a/src/lib/utils.js +++ b/src/lib/utils.js @@ -1,3 +1,14 @@ +import { browser } from "$app/env"; + export function scroll(section) { section.scrollIntoView({ behavior: 'smooth' }); } + +const base = browser ? "" : import.meta.env.VITE_COINOS_URL; + +export const post = (url, body) => + fetch(base + url, { + method: 'POST', + body: JSON.stringify(body), + headers: { 'accept': 'application/json', 'content-type': 'application/json' } + }).then(r => r.json); |
