From 12309da2457532d2674aba2e3b02700c5dfeae1d Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Tue, 26 Jul 2022 21:06:01 -0700 Subject: register endpoint --- src/lib/utils.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src/lib/utils.js') 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); -- cgit v1.2.3