diff --git a/frontend/src/lib/stores/candidate.ts b/frontend/src/lib/stores/candidate.ts index aeee6e9..a7fe70d 100644 --- a/frontend/src/lib/stores/candidate.ts +++ b/frontend/src/lib/stores/candidate.ts @@ -1,6 +1,4 @@ -import { apiFetchDetails, apiFillDetails, apiLogin, apiLogout } from "../@api/candidate"; import { writable } from "svelte/store"; -import { browser } from "$app/environment"; export interface CandidateData { name?: string; @@ -25,67 +23,4 @@ export interface CandidateLogin { password: string; } -export const candidateData = writable({}); - - -if (browser) { - const name = localStorage.getItem("name"); - const surname = localStorage.getItem("surname"); - const email = localStorage.getItem("email"); - if (name && email && surname) { - candidateData.set({ - name, - surname, - email - }); - } -} -candidateData.subscribe((val) => { - if (browser) { - localStorage.setItem("name", val.name ?? ""); - localStorage.setItem("surname", val.surname ?? ""); - localStorage.setItem("email", val.email ?? ""); - } -}) - - -export async function login(data: CandidateLogin) { - // TODO: handle errors - try { - const applicationId = await apiLogin(data); // TODO: set candidate data from response to store - console.log("login result: " + applicationId); - } catch (e) { - console.error("login failed"); - throw e; - } -} - -export async function logout() { - // TOOD: handle errors - try { - await apiLogout(); - candidateData.set({}); - } catch (e) { - console.error(e); - } -} - -export async function fillDetails(data: CandidateData) { - try { - const res = await apiFillDetails(data); - candidateData.set(res); - } catch (e) { - console.error(e); - throw e; - } -} - -export async function fetchDetails() { - try { - const res = await apiFetchDetails(); - candidateData.set(res); - } catch (e) { - console.error(e); - throw e; - } -} \ No newline at end of file +export const candidateData = writable({}); \ No newline at end of file diff --git a/frontend/src/lib/stores/portfolio.ts b/frontend/src/lib/stores/portfolio.ts index 1be0548..63bd20b 100644 --- a/frontend/src/lib/stores/portfolio.ts +++ b/frontend/src/lib/stores/portfolio.ts @@ -18,7 +18,7 @@ export const submissionProgress = writable({}); export async function fetchSubmProgress() { try { - let prog = await apiFetchSubmissionProgress(); + const prog = await apiFetchSubmissionProgress(); submissionProgress.set(prog); } catch (e) { console.error(e); diff --git a/frontend/src/routes/(candidate)/(authenticated)/register/+page.svelte b/frontend/src/routes/(candidate)/(authenticated)/register/+page.svelte index eaa8a0c..b541240 100644 --- a/frontend/src/routes/(candidate)/(authenticated)/register/+page.svelte +++ b/frontend/src/routes/(candidate)/(authenticated)/register/+page.svelte @@ -1,5 +1,6 @@