From c4e5a881929420f18dbed92ec954423f03887749 Mon Sep 17 00:00:00 2001 From: Sebastian Pravda Date: Tue, 29 Nov 2022 13:10:33 +0100 Subject: [PATCH] feat: nullable CandidateData fields --- frontend/src/routes/register/+page.svelte | 2 +- frontend/src/stores/candidate.ts | 49 ++++++++--------------- 2 files changed, 17 insertions(+), 34 deletions(-) diff --git a/frontend/src/routes/register/+page.svelte b/frontend/src/routes/register/+page.svelte index 7c0ada9..91193d5 100644 --- a/frontend/src/routes/register/+page.svelte +++ b/frontend/src/routes/register/+page.svelte @@ -22,7 +22,7 @@ let pageIndex = 0; let pagesFilled = 0; - const formInitialValues: CandidateData = { + const formInitialValues = { name: '', surname: '', email: '', diff --git a/frontend/src/stores/candidate.ts b/frontend/src/stores/candidate.ts index 422eb8f..27591c0 100644 --- a/frontend/src/stores/candidate.ts +++ b/frontend/src/stores/candidate.ts @@ -2,22 +2,21 @@ import { apiFetchDetails, apiFillDetails, apiLogin, apiLogout } from "../api/can import { writable } from "svelte/store"; export interface CandidateData { - // id?: string; - name: string; - surname: string; - birthplace: string; - birthdate: string; - address: string; - telephone: string; - citizenship: string; - email: string; - sex: string; - study: string; - personalIdNumber: string; - parentName: string; - parentSurname: string; - parentTelephone: string; - parentEmail: string; + name?: string; + surname?: string; + birthplace?: string; + birthdate?: string; + address?: string; + telephone?: string; + citizenship?: string; + email?: string; + sex?: string; + study?: string; + personalIdNumber?: string; + parentName?: string; + parentSurname?: string; + parentTelephone?: string; + parentEmail?: string; } export interface CandidateLogin { @@ -42,23 +41,7 @@ export async function logout() { // TOOD: handle errors try { await apiLogout(); - candidateData.set({ - name: "", - surname: "", - birthplace: "", - birthdate: "", - address: "", - telephone: "", - citizenship: "", - email: "", - sex: "", - study: "", - personalIdNumber: "", - parentName: "", - parentSurname: "", - parentTelephone: "", - parentEmail: "" - }); + candidateData.set({}); } catch (e) { console.error(e); }