Moved logic to parse API errors to a helper function

This commit is contained in:
Alejandro Celaya
2020-12-21 23:51:35 +01:00
parent 4c3772d5c8
commit d534a4e441
10 changed files with 23 additions and 10 deletions

4
src/api/util.ts Normal file
View File

@@ -0,0 +1,4 @@
import { AxiosError } from 'axios';
import { ProblemDetailsError } from '../utils/services/types';
export const parseApiError = (e: AxiosError<ProblemDetailsError>) => e.response?.data;