build hataları
This commit is contained in:
@ -163,17 +163,23 @@ export const useDataStore = defineStore('dataStore', () => {
|
||||
|
||||
const CheckApiError = async (status: number, data: Record<string, any>) => {
|
||||
if (status === 400) {
|
||||
const errorKey = data['hata'] || data['errors']
|
||||
const errorKey = typeof data === "string" ? data : data?.hata || data?.errors;
|
||||
|
||||
if (errorKey !== undefined) {
|
||||
errorKey.forEach((el: string) => {
|
||||
toastStore.AddToast(el, 'alert')
|
||||
})
|
||||
if (Array.isArray(errorKey)) {
|
||||
errorKey.forEach((el: string) => {
|
||||
toastStore.AddToast(el, "alert");
|
||||
});
|
||||
} else if (typeof errorKey === "string") {
|
||||
toastStore.AddToast(errorKey, "alert");
|
||||
} else {
|
||||
toastStore.AddToast("Bir hata oluştu.", "alert");
|
||||
}
|
||||
} else {
|
||||
toastStore.AddToast('Bir hata oluştu.', 'alert')
|
||||
toastStore.AddToast("Bir hata oluştu.", "alert");
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
const GetCustomerTipList = async () => {
|
||||
if (globalDataStore.customerTips.length === 0) {
|
||||
|
||||
Reference in New Issue
Block a user