mirror of
https://github.com/danbulant/Portfolio
synced 2026-05-27 05:51:56 +00:00
fix: refetch
This commit is contained in:
parent
233da205f3
commit
5c78b1136b
1 changed files with 10 additions and 4 deletions
|
|
@ -14,7 +14,10 @@
|
||||||
|
|
||||||
const getCandidates = async (field?: string) => {
|
const getCandidates = async (field?: string) => {
|
||||||
try {
|
try {
|
||||||
candidates = await apiListCandidates(undefined, field);
|
candidates = await apiListCandidates(
|
||||||
|
undefined,
|
||||||
|
field ?? activeFilter !== 'Vše' ? activeFilter : ''
|
||||||
|
);
|
||||||
} catch {
|
} catch {
|
||||||
console.log('error');
|
console.log('error');
|
||||||
}
|
}
|
||||||
|
|
@ -24,7 +27,7 @@
|
||||||
|
|
||||||
let filters: Array<Filter> = ['Vše', 'KBB', 'IT', 'GYM'];
|
let filters: Array<Filter> = ['Vše', 'KBB', 'IT', 'GYM'];
|
||||||
|
|
||||||
let activeFilter: Filter = 'Vše';
|
let activeFilter: Filter = filters[0];
|
||||||
|
|
||||||
const changeFilter = (filter: Filter) => {
|
const changeFilter = (filter: Filter) => {
|
||||||
activeFilter = filter;
|
activeFilter = filter;
|
||||||
|
|
@ -69,7 +72,7 @@
|
||||||
const deleteCandidate = async (id: number | undefined) => {
|
const deleteCandidate = async (id: number | undefined) => {
|
||||||
if (id) await apiDeleteCandidate(id);
|
if (id) await apiDeleteCandidate(id);
|
||||||
getCandidates();
|
getCandidates();
|
||||||
}
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
{#if createCandidateModal}
|
{#if createCandidateModal}
|
||||||
|
|
@ -148,7 +151,10 @@
|
||||||
{candidate.study}
|
{candidate.study}
|
||||||
</td>
|
</td>
|
||||||
<td class="whitespace-nowrap px-6 py-4 text-sm">
|
<td class="whitespace-nowrap px-6 py-4 text-sm">
|
||||||
<Delete on:delete={async () => await deleteCandidate(candidate.applicationId)} value="Odstranit" />
|
<Delete
|
||||||
|
on:delete={async () => await deleteCandidate(candidate.applicationId)}
|
||||||
|
value="Odstranit"
|
||||||
|
/>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
{/each}
|
{/each}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue