mirror of
https://github.com/luxfi/explore.git
synced 2026-09-24 00:28:18 +00:00
9 lines
404 B
TypeScript
9 lines
404 B
TypeScript
import type { ResourceError } from 'lib/api/resources';
|
|
|
|
import getErrorCause from './getErrorCause';
|
|
|
|
export default function getResourceErrorPayload<Payload = Record<string, unknown>>(error: Error | undefined): ResourceError<Payload>['payload'] | undefined {
|
|
const cause = getErrorCause(error);
|
|
return cause && 'payload' in cause ? cause.payload as ResourceError<Payload>['payload'] : undefined;
|
|
}
|