fix: surface notification test failures cleanly instead of as 500s

Server-side, return 200 with success: false and a friendly message when sendTestNotification reports failure (the underlying call already swallows the error); reserve real 500s for unexpected exceptions.

Client-side, teach usePost to honour the response body's success flag so success:false flips the toast to error without throwing through axios. Also tidy the toast container: drop icons, no wrapping, single-line ellipsis with a sensible max-width that hugs short messages.
This commit is contained in:
gorkem-bwl authored and Alex Holliday committed 2026-04-27 10:52:24 -07:00
1 parent 0d7e296a6c
commit 5a35286a0f
4 files changed
+21 -11

No files matched your search

+5 -1
View File
@@ -57,7 +57,11 @@ export const usePost = <B = any, R = any>() => {
...config?.headers,
},
});
toastSuccess(res.data?.msg || "Operation successful");
if (res.data?.success === false) {
toastError(res.data?.msg || "Operation failed");
} else {
toastSuccess(res.data?.msg || "Operation successful");
}
return res.data;
} catch (err: any) {