refactor: ♻️ Refactor toaster code for more accessibility and better UI

This commit is contained in:
Jesse Wierzbinski 2024-06-19 15:40:13 -10:00
parent 2b14813555
commit 5e6e881b98
No known key found for this signature in database
14 changed files with 96 additions and 151 deletions

View file

@ -29,7 +29,7 @@ export const useCacheRefresh = (client: MaybeRef<LysandClient | null>) => {
useEvent("notification:new", {
type: "error",
title: "Your session has expired",
message:
description:
"You have been logged out. Please log in again.",
});
}

View file

@ -17,7 +17,7 @@ export const useClient = (
useEvent("notification:new", {
title: "An error occured",
type: "error",
message:
description:
error.response.data.error ??
"No error message provided",
});

View file

@ -1,14 +1,11 @@
import type { createToaster } from "@ark-ui/vue";
import type { Attachment, Status } from "@lysand-org/client/types";
import mitt from "mitt";
import type { Identity } from "./Identities";
export type NotificationEvent = {
type: "error" | "success" | "progress";
title: string;
message?: string;
persistent?: boolean;
onDismiss?: () => void;
};
export type NotificationEvent = Parameters<
ReturnType<typeof createToaster>["create"]
>[0];
type ApplicationEvents = {
"note:reply": Status;