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 | 02ce8cd47c1cdf8a6f978b68c2251f141b128581 (patch) | |
| tree | ea78cb1e8683b53809ff584193ae8cc975ef72a2 /src/lib/utils.js | |
| parent | c8604d2b1a8a1ba1687ba18865c854518df0facd (diff) | |
| parent | 12309da2457532d2674aba2e3b02700c5dfeae1d (diff) | |
| download | coinos-ui-02ce8cd47c1cdf8a6f978b68c2251f141b128581.tar.gz coinos-ui-02ce8cd47c1cdf8a6f978b68c2251f141b128581.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); |
