Skip to content

Commit

Permalink
Fix mocked emails
Browse files Browse the repository at this point in the history
  • Loading branch information
Mlbiche committed Feb 28, 2022
1 parent 894c252 commit 2209833
Showing 1 changed file with 62 additions and 41 deletions.
103 changes: 62 additions & 41 deletions src/components/AuthenticationForm/AuthenticationForm.svelte
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
<script>
import { createEventDispatcher } from 'svelte'
import {
user,
loading,
patients
} from '../../js/store'
import { loading, patients, user } from '../../js/store'
import { authenticate, saveUser } from '../../services/UserService'
import Button from '../Button/Button.svelte'
import Snackbar from '../Snackbar/Snackbar.svelte'
Expand All @@ -15,12 +10,12 @@
email = naturapeuteEmail
$loading = true
authenticate(email)
.then((body) => {
.then(body => {
saveAuthenticatedUser(body)
user.initUpdated()
onAuthenticationDone()
})
.catch((_) => {
.catch(_ => {
onAuthenticationFailed()
})
.finally(() => {
Expand Down Expand Up @@ -52,25 +47,42 @@
$user.therapist.zipcode = office.zipcode
}
if(body.invoice_data.author.name) $user.author.name = body.invoice_data.author.name
if(body.invoice_data.author.street) $user.author.street = body.invoice_data.author.street
if(body.invoice_data.author.zipcode) $user.author.zipcode = body.invoice_data.author.zipcode
if(body.invoice_data.author.city) $user.author.city = body.invoice_data.author.city
if(body.invoice_data.author.email) $user.author.email = body.invoice_data.author.email
if(body.invoice_data.author.phone) $user.author.phone = body.invoice_data.author.phone
if(body.invoice_data.author.iban) $user.author.iban = body.invoice_data.author.iban
if(body.invoice_data.author.rcc) $user.author.rcc = body.invoice_data.author.rcc
if(body.invoice_data.therapist.firstname) $user.therapist.firstname = body.invoice_data.therapist.firstname
if(body.invoice_data.therapist.lastname) $user.therapist.lastname = body.invoice_data.therapist.lastname
if(body.invoice_data.therapist.street) $user.therapist.street = body.invoice_data.therapist.street
if(body.invoice_data.therapist.city) $user.therapist.city = body.invoice_data.therapist.city
if(body.invoice_data.therapist.zipcode) $user.therapist.zipcode = body.invoice_data.therapist.zipcode
if(body.invoice_data.therapist.phone) $user.therapist.phone = body.invoice_data.therapist.phone
if(body.invoice_data.therapist.rcc) $user.therapist.rcc = body.invoice_data.therapist.rcc
if(body.invoice_data.hourly_price) $user.servicePrice = body.invoice_data.hourly_price
if(body.invoice_data.services) $user.preferredServices = body.invoice_data.services.map(e => ({ ...e }))
if (body.invoice_data.author.name)
$user.author.name = body.invoice_data.author.name
if (body.invoice_data.author.street)
$user.author.street = body.invoice_data.author.street
if (body.invoice_data.author.zipcode)
$user.author.zipcode = body.invoice_data.author.zipcode
if (body.invoice_data.author.city)
$user.author.city = body.invoice_data.author.city
if (body.invoice_data.author.email)
$user.author.email = body.invoice_data.author.email
if (body.invoice_data.author.phone)
$user.author.phone = body.invoice_data.author.phone
if (body.invoice_data.author.iban)
$user.author.iban = body.invoice_data.author.iban
if (body.invoice_data.author.rcc)
$user.author.rcc = body.invoice_data.author.rcc
if (body.invoice_data.therapist.firstname)
$user.therapist.firstname = body.invoice_data.therapist.firstname
if (body.invoice_data.therapist.lastname)
$user.therapist.lastname = body.invoice_data.therapist.lastname
if (body.invoice_data.therapist.street)
$user.therapist.street = body.invoice_data.therapist.street
if (body.invoice_data.therapist.city)
$user.therapist.city = body.invoice_data.therapist.city
if (body.invoice_data.therapist.zipcode)
$user.therapist.zipcode = body.invoice_data.therapist.zipcode
if (body.invoice_data.therapist.phone)
$user.therapist.phone = body.invoice_data.therapist.phone
if (body.invoice_data.therapist.rcc)
$user.therapist.rcc = body.invoice_data.therapist.rcc
if (body.invoice_data.hourly_price)
$user.servicePrice = body.invoice_data.hourly_price
if (body.invoice_data.services)
$user.preferredServices = body.invoice_data.services.map(e => ({ ...e }))
$patients = body.patients.map(e => ({ ...e }))
if ($user.naturapeuteID) {
Expand Down Expand Up @@ -107,7 +119,7 @@
function onDemoMode() {
saveAuthenticatedUser({
email: 'john.doe@email.com',
email: 'john.doe@example.com',
phone: '0313172521',
firstname: 'John',
lastname: 'Doe',
Expand Down Expand Up @@ -142,7 +154,7 @@
lastname: 'Doakes',
birthdate: 45270000000,
gender: 'man',
email: 'joe.doakes@email.com',
email: 'joe.doakes@example.com',
street: 'Avenue de Rheinau 8',
zipcode: '1304',
city: 'Werdenberg',
Expand All @@ -156,33 +168,42 @@
</script>

<form class="aposto-form" on:submit|preventDefault={onAuthenticate}>
<TextField bind:value={email} type="email" fieldID="authentication-email" required>
<TextField
bind:value={email}
type="email"
fieldID="authentication-email"
required
>
Email
</TextField>
<Button className="connect-button" type="submit" title="Se connecter via le réseau Naturapeute" unelevated
disabled={$loading}>
<Button
className="connect-button"
type="submit"
title="Se connecter via le réseau Naturapeute"
unelevated
disabled={$loading}
>
Se connecter avec Naturapeute
</Button>
<a class="mdc-button" href="https://pro.naturapeute.ch/join">
<div class="mdc-button__ripple"></div>
<span class="mdc-button__label">
Rejoindre Naturapeute
</span>
<div class="mdc-button__ripple" />
<span class="mdc-button__label"> Rejoindre Naturapeute </span>
</a>
<Button title="Essayer en démo" on:click={onDemoMode} disabled={$loading}>
Essayer en démo
</Button>
<p class="demo-hint">
En mode démo, vous avez accès à l'intégralité de l'application, mais aucune de vos informations
n'est enregistrée. Vous devrez donc saisir de nouveau vos informations de thérapeute la
prochaine fois que vous revenez.
En mode démo, vous avez accès à l'intégralité de l'application, mais aucune
de vos informations n'est enregistrée. Vous devrez donc saisir de nouveau
vos informations de thérapeute la prochaine fois que vous revenez.
</p>
</form>

<Snackbar bind:this={failedAuthenticationSnackbar}>
<span slot="label">
Votre connexion auprès du réseau Naturapeute a échoué. Assurez-vous d'être bien inscrit auprès du
réseau et d'avoir renseigné l'adresse mail correspondant à votre inscription.
Votre connexion auprès du réseau Naturapeute a échoué. Assurez-vous d'être
bien inscrit auprès du réseau et d'avoir renseigné l'adresse mail
correspondant à votre inscription.
</span>
</Snackbar>

Expand Down

0 comments on commit 2209833

Please sign in to comment.