diff --git a/frontend/src/lib/@api/admin.ts b/frontend/src/lib/@api/admin.ts index 6ae2c9b..5fd7321 100644 --- a/frontend/src/lib/@api/admin.ts +++ b/frontend/src/lib/@api/admin.ts @@ -29,6 +29,16 @@ export const apiCreateCandidate = async (data: CreateCandidate): Promise => { + try { + const res = await axios.delete(API_URL + `/admin/candidate/${id}`, { withCredentials: true }); + return res.data; + } catch (e) { + throw errorHandler(e, 'Candidate creation failed'); + } +}; + // Reset candidate password /admin/candidate/{id}/reset_password export const apiResetCandidatePassword = async (id: number): Promise => { try { diff --git a/frontend/src/lib/components/admin/table/Table.svelte b/frontend/src/lib/components/admin/table/Table.svelte new file mode 100644 index 0000000..97755b7 --- /dev/null +++ b/frontend/src/lib/components/admin/table/Table.svelte @@ -0,0 +1,60 @@ + + +
+
+
+
+ + + + + + + + + + + {#each candidates as candidate} + + + + + + + + {/each} + +
Ev. č. přihlásky Jméno Příjmení Obor +
{candidate.applicationId} + {candidate.name} + + {candidate.surname} + + {candidate.study} + + +
+
+
+
+
+ + diff --git a/frontend/src/lib/components/button/Delete.svelte b/frontend/src/lib/components/button/Delete.svelte new file mode 100644 index 0000000..ae1f330 --- /dev/null +++ b/frontend/src/lib/components/button/Delete.svelte @@ -0,0 +1,65 @@ + + + + + diff --git a/frontend/src/routes/(admin)/admin/(authenticated)/dashboard/+page.svelte b/frontend/src/routes/(admin)/admin/(authenticated)/dashboard/+page.svelte index 6f07102..c50249c 100644 --- a/frontend/src/routes/(admin)/admin/(authenticated)/dashboard/+page.svelte +++ b/frontend/src/routes/(admin)/admin/(authenticated)/dashboard/+page.svelte @@ -1,11 +1,13 @@ {#if createCandidateModal} @@ -103,51 +113,7 @@ {/if} -
-
-
-
- - - - - - - - - - - {#each candidatesTable as candidate} - - - - - - - {/each} - -
- Ev. č. přihlásky - Jméno - Příjmení - Obor
{candidate.applicationId} - {candidate.name} - - {candidate.surname} - - {candidate.study} -
-
-
-
-
+ deleteCandidate(event.detail.id)} />