fix(prisma,api): execute ddl statements individually to fix P2021 error and eliminate duplicate toast notifications across app and admin panel
Deploy Canina / deploy (push) Successful in 1m47s
Deploy Canina / deploy (push) Successful in 1m47s
This commit is contained in:
1 parent
13300236f3
commit
e1b035d6dd
5 files changed
+97
-68
No files matched your search
@@ -87,12 +87,20 @@ api.interceptors.response.use(
|
||||
|
||||
// Show formatted Farsi toast if not explicitly suppressed and not 401/403/404
|
||||
if (!error.config?.hideErrorToast && status !== 401 && status !== 403 && status !== 404) {
|
||||
let fullMessage = farsiMessage;
|
||||
if (responseData?.details && Array.isArray(responseData.details) && responseData.details.length > 0) {
|
||||
const firstDetailMessage = responseData.details[0]?.message || farsiMessage;
|
||||
toast.error(firstDetailMessage);
|
||||
} else {
|
||||
toast.error(farsiMessage);
|
||||
const detailStrings = responseData.details
|
||||
.map((d: unknown) => typeof d === 'string' ? d : ((d as Record<string, string>)?.message || (d as Record<string, string>)?.field))
|
||||
.filter(Boolean);
|
||||
if (detailStrings.length > 0) {
|
||||
const joinedDetails = detailStrings.join('، ');
|
||||
if (!farsiMessage.includes(joinedDetails)) {
|
||||
fullMessage = `${farsiMessage} (${joinedDetails})`;
|
||||
}
|
||||
}
|
||||
}
|
||||
toast.error(fullMessage, { id: fullMessage });
|
||||
(error as unknown as Record<string, boolean>)._toastShown = true;
|
||||
}
|
||||
}
|
||||
return Promise.reject(error);
|
||||
|
||||
Reference in new issue
Block a user