dasdasd
This commit is contained in:
10
core/utils/index.ts
Normal file
10
core/utils/index.ts
Normal file
@@ -0,0 +1,10 @@
|
||||
import axios from "axios";
|
||||
|
||||
export function handleAxiosError(error: unknown) {
|
||||
if (axios.isAxiosError(error)) {
|
||||
// اینجا میدونیم که خطا از axios است
|
||||
return error.response?.data?.error?.message;
|
||||
} else {
|
||||
return "Unexpected error";
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user