fix: add hidden_icon option to actionToast for conditional icon rendering

This commit is contained in:
faisolavolut 2025-03-05 12:02:01 +07:00
parent d04d1158c6
commit 57b87bf707
1 changed files with 7 additions and 1 deletions

View File

@ -11,6 +11,7 @@ export const actionToast = async (data: {
msg_succes?: string; msg_succes?: string;
msg_error?: string; msg_error?: string;
msg_load?: string; msg_load?: string;
hidden_icon?: boolean;
}) => { }) => {
const { const {
task, task,
@ -21,6 +22,7 @@ export const actionToast = async (data: {
msg_error, msg_error,
msg_load, msg_load,
failed, failed,
hidden_icon,
} = data; } = data;
try { try {
@ -75,7 +77,11 @@ export const actionToast = async (data: {
toast.error( toast.error(
<div className="flex flex-col w-full"> <div className="flex flex-col w-full">
<div className="flex text-red-600 items-center"> <div className="flex text-red-600 items-center">
{hidden_icon !== true ? (
<AlertTriangle className="h-4 w-4 mr-1" /> <AlertTriangle className="h-4 w-4 mr-1" />
) : (
<></>
)}
{msg_error ? msg_error : " Failed"}{" "} {msg_error ? msg_error : " Failed"}{" "}
{get(ex, "response.data.meta.message") || ex.message}. {get(ex, "response.data.meta.message") || ex.message}.
</div> </div>