feat(!): return 204 instead of useless json responses, add fastFetch

This commit is contained in:
Sam 2023-03-30 16:05:40 +02:00
parent abc78f3a9a
commit 9c8b6a8f91
Signed by: sam
GPG key ID: B4EF20DDE721CAA1
16 changed files with 63 additions and 31 deletions

View file

@ -1,7 +1,7 @@
<script lang="ts">
import { goto } from "$app/navigation";
import { type MeUser, userAvatars, type APIError, MAX_MEMBERS } from "$lib/api/entities";
import { apiFetchClient } from "$lib/api/fetch";
import { apiFetchClient, fastFetchClient } from "$lib/api/fetch";
import { usernameRegex } from "$lib/api/regex";
import ErrorAlert from "$lib/components/ErrorAlert.svelte";
import FallbackImage from "$lib/components/FallbackImage.svelte";
@ -37,7 +37,7 @@
const deleteAccount = async () => {
try {
await apiFetchClient<any>("/users/@me", "DELETE");
await fastFetchClient("/users/@me", "DELETE");
userStore.set(null);
localStorage.removeItem("pronouns-token");

View file

@ -3,7 +3,7 @@
import { DateTime, Duration } from "luxon";
import { Alert, Button } from "sveltestrap";
import { PUBLIC_BASE_URL } from "$env/static/public";
import { apiFetchClient } from "$lib/api/fetch";
import { fastFetchClient } from "$lib/api/fetch";
import type { APIError } from "$lib/api/entities";
import { addToast } from "$lib/toast";
import ErrorAlert from "$lib/components/ErrorAlert.svelte";
@ -23,7 +23,7 @@
const requestExport = async () => {
try {
await apiFetchClient<any>("/users/@me/export/start");
await fastFetchClient("/users/@me/export/start");
addToast({
header: "Export in progress",

View file

@ -1,6 +1,6 @@
<script lang="ts">
import type { APIError } from "$lib/api/entities";
import { apiFetchClient } from "$lib/api/fetch";
import { apiFetchClient, fastFetchClient } from "$lib/api/fetch";
import ErrorAlert from "$lib/components/ErrorAlert.svelte";
import { addToast } from "$lib/toast";
import { DateTime } from "luxon";
@ -12,7 +12,7 @@
const acknowledgeWarning = async (idx: number) => {
try {
await apiFetchClient<any>(`/auth/warnings/${data.warnings[idx].id}/ack`, "POST");
await fastFetchClient(`/auth/warnings/${data.warnings[idx].id}/ack`, "POST");
addToast({
header: "Acknowledged",
body: `Marked warning #${data.warnings[idx].id} as read.`,