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:
1 parent
0d7e296a6c
commit
5a35286a0f
4 files changed
+21
-11
No files matched your search
@@ -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) {
|
||||
|
||||
Reference in new issue
Block a user