mirror of
https://github.com/mashirozx/sakura.git
synced 2025-05-29 01:49:21 +08:00
14 lines
313 B
TypeScript
14 lines
313 B
TypeScript
export default function (error: any) {
|
|
if (error.response) {
|
|
return {
|
|
type: 'Response Error',
|
|
msg: error.response.data.message ?? error.response.data, // Standard WP_Rest_Error
|
|
}
|
|
} else {
|
|
return {
|
|
type: 'Request Error',
|
|
msg: error.message, // eg. network error
|
|
}
|
|
}
|
|
}
|