aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/utils.js
blob: c17b0a981e94706cedfd5818148641d9412f11cd (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
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());
d border-primary input-lg rounded-2xl flex items-center gap-2" > {#if hide} <input onkeydown={validate} use:focus bind:value={v} type="password" class="clean text-center !text-5xl !w-96 block" pattern="[0-9]+" /> {:else} <input onkeydown={validate} use:focus bind:value={v} class="clean text-center !text-5xl !w-96 block" type="text" pattern="[0-9]+" /> {/if} <iconify-icon icon={hide ? "ph:eye-slash-bold" : "ph:eye-bold"} width="32" onclick={stopPropagation(preventDefault(() => (hide = !hide)))} class="cursor-pointer" ></iconify-icon> </label> <div class="grid grid-cols-3 gap-2 w-[300px] mx-auto grayscale"> {#each numPad as value} {#if value === arrow} <button type="button" class="btn" onclick={(e) => handleInput(e, value)}> <Left /> </button> {:else} <button type="button" class="btn" onclick={(e) => handleInput(e, value)} >{value}</button > {/if} {/each} </div>