pass fullMessage from error (create-kp)
This commit is contained in:
parent
d9bf1790e7
commit
d4effe2210
@ -4,12 +4,13 @@ import type { AxiosError } from 'axios';
|
||||
import { isAxiosError } from 'axios';
|
||||
import { pick } from 'radash';
|
||||
|
||||
function getErrorMessage<T extends { error?: string; errors?: string[]; message?: string }>(
|
||||
error: AxiosError<T>
|
||||
) {
|
||||
function getErrorMessage<
|
||||
T extends { error?: string; errors?: string[]; fullMessage?: string; message?: string }
|
||||
>(error: AxiosError<T>) {
|
||||
return (
|
||||
error.response?.data?.error ||
|
||||
error.response?.data?.errors?.[0] ||
|
||||
error.response?.data.fullMessage ||
|
||||
error.response?.data?.message ||
|
||||
error.message
|
||||
);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user