fb-register/login

This commit is contained in:
Ota Prokopec 2023-01-29 19:16:07 +01:00
parent 5096950ce4
commit 7ac668132c
3 changed files with 11 additions and 4 deletions

View File

@ -1,15 +1,22 @@
<script lang="ts">
import './main.scss'
import { i18n, isLoading as localeLoading } from '$lib/locales'
import { isLoading as authLoading } from '$lib/appwrite'
import { isLoading as authLoading, user } from '$lib/appwrite'
import { onMount } from 'svelte'
import Routes from './__routes.svelte'
import CookiesPopUp from '$lib/components/Cookies/CookiesPopUp.svelte'
import { navigate } from '$lib/router'
let isMounted = false
$: isReady = $localeLoading === false && $authLoading === false && isMounted
$: if (isReady && !$user) {
if (!(location.pathname.startsWith('/login') || location.pathname.startsWith('/register'))) {
navigate('/login')
}
}
onMount(() => {
/** init i18n */
i18n()

View File

@ -1,4 +1,5 @@
<script>
import { account } from '$lib/appwrite'
import HiddenInput from '../lib/Components/Inputs/Hidden_Input.svelte'
import GoogleLogo from '../lib/svg/GoogleLogo.svelte'
import TopImage from '../lib/svg/Top-Image.svelte'
@ -46,7 +47,7 @@
<p>Continue with Google</p>
</button>
<button>
<button on:click={() => account.createOAuth2Session('facebook')}>
<p>Continue with Facebook</p>
</button>
</div>

View File

@ -11,7 +11,6 @@
let password = 'aaaaaaaa'
let repeatPassword = 'aaaaaaaa'
let name = 'Ota Prokopec'
$: console.log(password)
const register = async () => {
//if (password === repeatPassword || name.length < 8 || email.length < 8) throw new Error('conditions are not fine')
@ -62,8 +61,8 @@
<input bind:value={email} type="text" placeholder="E-mail" autocomplete="email" required />
<HiddenInput bind:value={password} placeholder="Password" />
<HiddenInput bind:value={repeatPassword} placeholder="Re-type password" />
<input class="cursor-pointer" on:click={() => register()} type="submit" value="Sign up" />
</form>
<button on:click={() => register()}>Sign up</button>
{/if}
</div>