mirror of
https://github.com/danbulant/Portfolio
synced 2026-05-24 12:35:31 +00:00
feat: show application id number and field of study in extended infoCard
This commit is contained in:
parent
af80faaa12
commit
426d2e5988
5 changed files with 18 additions and 7 deletions
|
|
@ -1,5 +1,5 @@
|
|||
import axios, { type AxiosProgressEvent } from 'axios';
|
||||
import type { CandidateData, CandidateLogin } from '$lib/stores/candidate';
|
||||
import type { 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';
|
||||
|
|
@ -52,7 +52,7 @@ export const apiFetchSubmissionProgress = async (fetchSsr?: Fetch): Promise<Subm
|
|||
}
|
||||
};
|
||||
|
||||
export const apiWhoami = async (fetchSsr?: Fetch): Promise<string> => {
|
||||
export const apiWhoami = async (fetchSsr?: Fetch): Promise<CreateCandidate> => {
|
||||
const apiFetch = fetchSsr || fetch;
|
||||
try {
|
||||
console.log(API_URL + '/candidate/whoami');
|
||||
|
|
@ -63,7 +63,7 @@ export const apiWhoami = async (fetchSsr?: Fetch): Promise<string> => {
|
|||
if (res.status != 200) {
|
||||
throw Error(await res.text());
|
||||
}
|
||||
return await res.text();
|
||||
return await res.json();
|
||||
} catch (e) {
|
||||
throw errorHandler(e, 'Failed to fetch whoami');
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
import { fetchSubmProgress, type Status } from '$lib/stores/portfolio';
|
||||
import StatusNotificationBig from './StatusNotificationBig.svelte';
|
||||
import InfoButton from './InfoButton.svelte';
|
||||
import { candidateData } from '$lib/stores/candidate';
|
||||
import { baseCandidateData, candidateData } from '$lib/stores/candidate';
|
||||
import tippy, {sticky} from 'tippy.js';
|
||||
import { goto } from '$app/navigation';
|
||||
|
||||
|
|
@ -103,6 +103,8 @@
|
|||
}}
|
||||
class="mt-4 flex flex-col justify-between leading-10"
|
||||
>
|
||||
<span>Ev. č. přihlášky: <span class="font-bold">{$baseCandidateData.applicationId}</span></span>
|
||||
<span>Obor: <span class="font-bold">{$candidateData.candidate.study}</span></span>
|
||||
<span>Adresa: <span class="font-bold">{$candidateData.candidate.address}</span></span>
|
||||
<span
|
||||
>Datum narození: <span class="font-bold">{$candidateData.candidate.birthdate}</span
|
||||
|
|
@ -162,7 +164,7 @@
|
|||
|
||||
@apply bg-[#f8fbfc];
|
||||
@apply rounded-3xl;
|
||||
@apply px-7 py-10;
|
||||
@apply px-7 py-10 <2xl:px-5 <2xl:py-5;
|
||||
|
||||
@apply transition-all duration-300;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -43,6 +43,11 @@ export interface CreateCandidateLogin extends CreateCandidate {
|
|||
password: string;
|
||||
}
|
||||
|
||||
export const baseCandidateData= writable<CreateCandidate>({
|
||||
applicationId: 0,
|
||||
personalIdNumber: ''
|
||||
});
|
||||
|
||||
export const candidateData = writable<CandidateData>({
|
||||
candidate: {
|
||||
name: '',
|
||||
|
|
|
|||
|
|
@ -7,9 +7,12 @@ export const load: LayoutServerLoad = async ({ cookies, fetch }) => {
|
|||
const isAuthenticated = cookies.get('id');
|
||||
|
||||
if (isAuthenticated) {
|
||||
await apiWhoami(fetch).catch((e) => {
|
||||
const whoami = await apiWhoami(fetch).catch((e) => {
|
||||
throw redirect(302, '/auth/logout');
|
||||
});
|
||||
return {
|
||||
whoami: whoami
|
||||
}
|
||||
} else {
|
||||
throw redirect(302, '/auth/logout');
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@
|
|||
UploadStatus,
|
||||
type Status
|
||||
} from '$lib/stores/portfolio';
|
||||
import { candidateData } from '$lib/stores/candidate';
|
||||
import { baseCandidateData, candidateData } from '$lib/stores/candidate';
|
||||
|
||||
export let data: PageData;
|
||||
|
||||
|
|
@ -25,6 +25,7 @@
|
|||
|
||||
$: candidateData.set(data.candidate);
|
||||
$: submissionProgress.set(data.submission);
|
||||
$: baseCandidateData.set(data.whoami);
|
||||
|
||||
const getUploadStatus = (progressStatus: UploadStatus | undefined): Status => {
|
||||
switch (progressStatus) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue