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
@@ -118,13 +118,23 @@ api.interceptors.response.use(
|
||||
}
|
||||
|
||||
if (status === 403) {
|
||||
toast.error('دسترسی شما به این بخش از پنل ادمین مجاز نمیباشد.');
|
||||
} else if (status !== 401) {
|
||||
toast.error('دسترسی شما به این بخش از پنل ادمین مجاز نمیباشد.', { id: 'admin-403' });
|
||||
(error as unknown as Record<string, boolean>)._toastShown = true;
|
||||
} else if (status !== 401 && !(originalRequest as unknown as Record<string, boolean>)?.hideErrorToast) {
|
||||
let fullMessage = farsiMessage;
|
||||
if (responseData?.details && Array.isArray(responseData.details) && responseData.details.length > 0) {
|
||||
toast.error(responseData.details[0]?.message || farsiMessage);
|
||||
} 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