mirror of
https://github.com/danbulant/Portfolio
synced 2026-05-24 12:35:31 +00:00
feat: two applications support candidate dashboard
This commit is contained in:
parent
cb25e713e6
commit
6655e9978f
3 changed files with 27 additions and 6 deletions
|
|
@ -1,5 +1,5 @@
|
|||
import axios, { type AxiosProgressEvent } from 'axios';
|
||||
import type { CandidateData, CandidateLogin, CreateCandidate } from '$lib/stores/candidate';
|
||||
import type { BaseCandidate, CandidateData, CandidateLogin, CreateCandidate } from '$lib/stores/candidate';
|
||||
import type { SubmissionProgress } from '$lib/stores/portfolio';
|
||||
import { API_URL, errorHandler, type Fetch } from '.';
|
||||
import DOMPurify from 'isomorphic-dompurify';
|
||||
|
|
@ -51,7 +51,7 @@ export const apiFetchSubmissionProgress = async (fetchSsr?: Fetch): Promise<Subm
|
|||
}
|
||||
};
|
||||
|
||||
export const apiWhoami = async (fetchSsr?: Fetch): Promise<CreateCandidate> => {
|
||||
export const apiWhoami = async (fetchSsr?: Fetch): Promise<BaseCandidate> => {
|
||||
const apiFetch = fetchSsr || fetch;
|
||||
try {
|
||||
console.log(API_URL + '/candidate/whoami');
|
||||
|
|
|
|||
|
|
@ -65,6 +65,16 @@
|
|||
}
|
||||
};
|
||||
|
||||
const getField = (id: number) => {
|
||||
if (id.toString().startsWith("101")) {
|
||||
return 'G';
|
||||
} else if (id.toString().startsWith("102")) {
|
||||
return 'IT';
|
||||
} else {
|
||||
return 'KB';
|
||||
}
|
||||
};
|
||||
|
||||
const editDetails = async () => {
|
||||
goto('/register?edit=true');
|
||||
};
|
||||
|
|
@ -140,9 +150,15 @@
|
|||
class="mt-4 flex flex-col justify-between leading-10"
|
||||
>
|
||||
<span
|
||||
>Ev. č. přihlášky: <span class="font-bold">{$baseCandidateData.applicationId}</span
|
||||
></span
|
||||
>Ev. č. přihlášky ({getField($baseCandidateData.applications[0])}):
|
||||
<span class="font-bold">{$baseCandidateData.applications[0]}</span></span
|
||||
>
|
||||
{#if $baseCandidateData.applications.length > 1}
|
||||
<span
|
||||
>Ev. č. přihlášky ({getField($baseCandidateData.applications[1])}):
|
||||
<span class="font-bold">{$baseCandidateData.applications[1]}</span></span
|
||||
>
|
||||
{/if}
|
||||
<span>Obor: <span class="font-bold">{$candidateData.candidate.study}</span></span>
|
||||
<span>Adresa: <span class="font-bold">{$candidateData.candidate.address}</span></span>
|
||||
<span
|
||||
|
|
|
|||
|
|
@ -41,12 +41,17 @@ export interface CreateCandidate {
|
|||
personalIdNumber: string;
|
||||
}
|
||||
|
||||
export interface BaseCandidate {
|
||||
applications: Array<number>;
|
||||
personalIdNumber: string;
|
||||
}
|
||||
|
||||
export interface CreateCandidateLogin extends CreateCandidate {
|
||||
password: string;
|
||||
}
|
||||
|
||||
export const baseCandidateData = writable<CreateCandidate>({
|
||||
applicationId: 0,
|
||||
export const baseCandidateData = writable<BaseCandidate>({
|
||||
applications: [],
|
||||
personalIdNumber: ''
|
||||
});
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue