-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
712bf27
commit da38302
Showing
10 changed files
with
169 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
<script lang="ts"> | ||
import { fetchAPI } from '$lib/api'; | ||
import { typeToName, type DiscordInteraction } from '$lib/constants'; | ||
import { useQueryClient } from '@tanstack/svelte-query'; | ||
import toast_, { type Toast } from 'svelte-french-toast'; | ||
export let toast: Toast; | ||
const queryClient = useQueryClient(); | ||
// @ts-ignore svelte-french-toast does not include props in latest version | ||
const props: { cmd: DiscordInteraction; basePath: string; queryKey: string[] } = toast.props; | ||
async function proceed() { | ||
toast_.dismiss(toast.id) | ||
try { | ||
await toast_.promise(fetchAPI(`${props.basePath}/${props.cmd.id}`, { method: 'DELETE' }), { | ||
success: `${typeToName(props.cmd.type)} successfully deleted`, | ||
error: 'Error occurred, try again', | ||
loading: 'Deletion pending...' | ||
}); | ||
console.log('success'); | ||
queryClient.invalidateQueries({ queryKey: props.queryKey }); | ||
} catch (err) { | ||
console.log(`Error while deleting [FORWARDED]`); | ||
console.error(err); | ||
} | ||
} | ||
</script> | ||
|
||
<span> | ||
Are you sure you want to, Delete "{props.cmd.name}" {typeToName(props.cmd.type)} Interaction? | ||
|
||
<div class="flex gap-1 mt-1"> | ||
<button | ||
class="p-2 rounded-lg bg-blurple-200 hover:bg-blurple-300" | ||
on:click={() => toast_.dismiss(toast.id)} | ||
> | ||
Never mind | ||
</button> | ||
<button class="p-2 rounded-lg bg-red-200 hover:bg-red-300" on:click={proceed}> | ||
Proceed with deletion | ||
</button> | ||
</div> | ||
</span> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<script lang="ts"> | ||
import {browser} from "$app/environment"; | ||
import { base } from '$app/paths'; | ||
import { page } from '$app/stores'; | ||
</script> | ||
|
||
<div class="m-2"> | ||
<h1 class="text-xl font-bold">Add</h1> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.