mirror of
https://github.com/danbulant/Portfolio
synced 2026-05-27 14:02:14 +00:00
feat: delete submitted portfolio
This commit is contained in:
parent
b16c24352e
commit
c482287c3e
1 changed files with 15 additions and 9 deletions
|
|
@ -1,5 +1,5 @@
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { apiSubmitPortfolio } from '$lib/@api/candidate';
|
import { apiDeltePortfolio, apiSubmitPortfolio } from '$lib/@api/candidate';
|
||||||
import Circles from '$lib/components/icons/Circles.svelte';
|
import Circles from '$lib/components/icons/Circles.svelte';
|
||||||
import { fetchSubmProgress, type Status } from '$lib/stores/portfolio';
|
import { fetchSubmProgress, type Status } from '$lib/stores/portfolio';
|
||||||
import StatusNotificationBig from './StatusNotificationBig.svelte';
|
import StatusNotificationBig from './StatusNotificationBig.svelte';
|
||||||
|
|
@ -7,27 +7,34 @@
|
||||||
export let title: string;
|
export let title: string;
|
||||||
export let status: Status;
|
export let status: Status;
|
||||||
|
|
||||||
let uploading = false;
|
let loading = false;
|
||||||
|
|
||||||
const submit = async () => {
|
const submitPortfolio = async () => {
|
||||||
uploading = true;
|
loading = true;
|
||||||
await apiSubmitPortfolio();
|
await apiSubmitPortfolio();
|
||||||
await fetchSubmProgress();
|
await fetchSubmProgress();
|
||||||
uploading = false;
|
loading = false;
|
||||||
|
};
|
||||||
|
|
||||||
|
const deletePortfolio = async () => {
|
||||||
|
loading = true;
|
||||||
|
await apiDeltePortfolio();
|
||||||
|
await fetchSubmProgress();
|
||||||
|
loading = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleNotificationClick = async () => {
|
const handleNotificationClick = async () => {
|
||||||
if (status === "uploaded") {
|
if (status === "uploaded") {
|
||||||
await submit();
|
await submitPortfolio();
|
||||||
} else if (status === "submitted") {
|
} else if (status === "submitted") {
|
||||||
|
await deletePortfolio();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div class="card flex flex-col">
|
<div class="card flex flex-col">
|
||||||
<div class="infoBar flex flex-row-reverse">
|
<div class="infoBar flex flex-row-reverse">
|
||||||
<StatusNotificationBig loading={uploading} {status} on:click={handleNotificationClick} />
|
<StatusNotificationBig {loading} {status} on:click={handleNotificationClick} />
|
||||||
</div>
|
</div>
|
||||||
<div class="relative flex flex-row justify-between">
|
<div class="relative flex flex-row justify-between">
|
||||||
<div>
|
<div>
|
||||||
|
|
@ -43,7 +50,6 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
|
|
||||||
.card {
|
.card {
|
||||||
@apply m-3;
|
@apply m-3;
|
||||||
@apply h-full;
|
@apply h-full;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue