💾 added basic svelte store

ref #1
This commit is contained in:
Philipp Dormann 2021-03-15 14:11:24 +01:00
parent e4f5a810a4
commit df3621d086
2 changed files with 5 additions and 0 deletions

View File

@ -15,6 +15,7 @@
<form class="flex flex-col pt-3 md:pt-8" onsubmit="event.preventDefault();" on:submit={()=> <form class="flex flex-col pt-3 md:pt-8" onsubmit="event.preventDefault();" on:submit={()=>
{ {
console.log(token); console.log(token);
apikey.set(token)
}}> }}>
<div class="flex flex-col pt-4"> <div class="flex flex-col pt-4">
<label for="token" class="text-lg">Client Token</label> <label for="token" class="text-lg">Client Token</label>
@ -75,6 +76,7 @@
</div> </div>
</div> </div>
<script> <script>
import {apikey} from './store.js';
let token; let token;
$: isTokenValid=token?.length===44&& token.split(".")[0].length===7 &&isUUID(token.split(".")[1]); $: isTokenValid=token?.length===44&& token.split(".")[0].length===7 &&isUUID(token.split(".")[1]);
function isUUID ( uuid ) { function isUUID ( uuid ) {

3
app/src/store.js Normal file
View File

@ -0,0 +1,3 @@
import { writable } from 'svelte/store';
export const apikey = writable('');