build hataları

This commit is contained in:
burakovec
2025-09-02 09:44:55 +03:00
parent 847b1c1b37
commit 7379f4ae5e
8 changed files with 28 additions and 17 deletions

View File

@ -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) {