mirror of
https://github.com/muerwre/orchidmap-front.git
synced 2025-04-24 18:46:40 +07:00
14 lines
329 B
TypeScript
14 lines
329 B
TypeScript
import { AxiosError } from 'axios';
|
|
import { PostMapResponse } from '~/utils/api/types';
|
|
|
|
export const postMapInterceptor = (res: AxiosError<PostMapResponse>) => {
|
|
if (res.response?.data.code) {
|
|
return res.response;
|
|
}
|
|
|
|
if (res.response?.data.error) {
|
|
throw new Error(res.response?.data.error);
|
|
}
|
|
|
|
throw res;
|
|
};
|