Skip to content

Commit

Permalink
Removes toast from enhanced form handlers
Browse files Browse the repository at this point in the history
  • Loading branch information
allanlasser committed Nov 26, 2024
1 parent 7ce4d3d commit 83e1645
Show file tree
Hide file tree
Showing 5 changed files with 0 additions and 21 deletions.
2 changes: 0 additions & 2 deletions src/lib/components/forms/AddOnDispatch.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
import { autofield } from "../inputs/generator";
import { schedules } from "$lib/api/addons";
import { getCurrentUser } from "$lib/utils/permissions";
import { toast } from "../layouts/Toaster.svelte";
export let properties: any = {};
export let required: string[] = [];
Expand Down Expand Up @@ -110,7 +109,6 @@
const { type, data } = result;
if (type === "success") {
created = data.type === "event" ? data.event : data.run;
toast($_("addonDispatchDialog.success"), { status: "success" });
dispatch("dispatch", data);
}
update(result);
Expand Down
4 changes: 0 additions & 4 deletions src/lib/components/forms/ConfirmDelete.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ Confirm deletion or one or more documents.
import { canonicalUrl, deleted } from "$lib/api/documents";
import { getCurrentUser } from "$lib/utils/permissions";
import { toast } from "../layouts/Toaster.svelte";
const me = getCurrentUser();
Expand Down Expand Up @@ -43,9 +42,6 @@ Confirm deletion or one or more documents.
return ({ result, update }) => {
if (result.type === "success") {
ids.forEach((d) => $deleted.add(String(d)));
toast($_("delete.success", { values: { n: count } }), {
status: "success",
});
dispatch("close");
} else {
console.error(result);
Expand Down
5 changes: 0 additions & 5 deletions src/lib/components/forms/ConfirmRedaction.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ This almost certainly lives in a modal.
redactions,
} from "$lib/components/viewer/RedactionLayer.svelte";
import { canonicalUrl } from "$lib/api/documents";
import { toast } from "../layouts/Toaster.svelte";
export let document: Document;
Expand All @@ -40,16 +39,12 @@ This almost certainly lives in a modal.
// `result` is an `ActionResult` object
if (result.type === "failure") {
error = result.data.error;
toast($_("redact.error") + `: ${error}`, {
status: "error",
});
}
if (result.type === "success") {
// need to invalidate before navigating
await invalidate(`document:${document.id}`);
$pending = result.data.redactions;
toast($_("redact.success"), { status: "success" });
goto("?mode=document");
dispatch("close");
}
Expand Down
5 changes: 0 additions & 5 deletions src/lib/components/forms/UserFeedback.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
import Button from "../common/Button.svelte";
import Flex from "../common/Flex.svelte";
import Avatar from "../accounts/Avatar.svelte";
import { toast } from "../layouts/Toaster.svelte";
import { APP_URL } from "@/config/config";
import { getUserName } from "$lib/api/accounts";
Expand Down Expand Up @@ -54,13 +53,9 @@
return async ({ result }) => {
if (result.type === "success") {
status = "success";
toast($_("feedback.success"), {
status: "success",
});
dispatch("close");
} else if (result.type === "failure") {
status = "error";
toast(result.error, { status: "error" });
}
};
}
Expand Down
5 changes: 0 additions & 5 deletions src/lib/components/forms/stories/UserFeedback.stories.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import UserFeedbackForm from "../UserFeedback.svelte";
import { me } from "@/test/fixtures/accounts";
import { feedback } from "@/test/handlers/feedback";
import Toaster from "../../layouts/Toaster.svelte";
export const meta = {
title: "Forms / User Feedback",
Expand All @@ -20,27 +19,23 @@
<Story name="With User">
<div style="max-width: 45rem;">
<UserFeedbackForm user={me} />
<Toaster />
</div>
</Story>

<Story name="Without User">
<div style="max-width: 45rem;">
<UserFeedbackForm />
<Toaster />
</div>
</Story>

<Story name="Loading" parameters={{ msw: { handlers: [feedback.loading] } }}>
<div style="max-width: 45rem;">
<UserFeedbackForm />
<Toaster />
</div>
</Story>

<Story name="With Error" parameters={{ msw: { handlers: [feedback.error] } }}>
<div style="max-width: 45rem;">
<UserFeedbackForm />
<Toaster />
</div>
</Story>

0 comments on commit 83e1645

Please sign in to comment.