diff --git a/frontend/src/lib/@api/admin.ts b/frontend/src/lib/@api/admin.ts index 5fd7321..d77f283 100644 --- a/frontend/src/lib/@api/admin.ts +++ b/frontend/src/lib/@api/admin.ts @@ -120,3 +120,23 @@ export const apiFetchCandidate = async (id: number, fetchSsr?: Fetch): Promise => { + const apiFetch = fetchSsr || fetch; + try { + const res = await apiFetch(API_URL + '/admin/list/candidates_csv', { + method: 'GET', + credentials: 'include' + }); + if (res.status != 200) { + throw Error(await res.text()); + } + return await res.blob(); + } catch (e) { + throw errorHandler(e, 'List candidates CSV failed'); + } +}; diff --git a/frontend/src/routes/(admin)/admin/(authenticated)/dashboard/+page.svelte b/frontend/src/routes/(admin)/admin/(authenticated)/dashboard/+page.svelte index c50249c..ad4d307 100644 --- a/frontend/src/routes/(admin)/admin/(authenticated)/dashboard/+page.svelte +++ b/frontend/src/routes/(admin)/admin/(authenticated)/dashboard/+page.svelte @@ -1,5 +1,5 @@ {#if createCandidateModal} @@ -99,9 +112,14 @@ + {#if scrollTop > 200}
@@ -113,7 +131,7 @@
{/if} - deleteCandidate(event.detail.id)} /> +
deleteCandidate(event.detail.id)} />