diff options
| author | Adam Soltys <[email protected]> | 2022-07-26 21:06:01 -0700 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2022-07-26 21:06:01 -0700 |
| commit | 059613490db9be904791686c49851ec1cc095774 (patch) | |
| tree | dbf229d10d44b19bac1312b5847d75c4c04d0261 /src/lib/utils.js | |
| parent | b13d88d63dbd7ce7df9d6847036d3e36d78f97b2 (diff) | |
| download | coinos-ui-059613490db9be904791686c49851ec1cc095774.tar.gz coinos-ui-059613490db9be904791686c49851ec1cc095774.zip | |
register endpoint
Diffstat (limited to 'src/lib/utils.js')
| -rw-r--r-- | src/lib/utils.js | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/lib/utils.js b/src/lib/utils.js index 595d2dd8..b1bc24ec 100644 --- a/src/lib/utils.js +++ b/src/lib/utils.js @@ -1,10 +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(url, { + fetch(base + url, { method: 'POST', body: JSON.stringify(body), headers: { 'accept': 'application/json', 'content-type': 'application/json' } - }); + }).then(r => r.json); |
