This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Auth from '@aws-amplify/auth' | |
/** | |
USAGE: | |
> api.post(`users/${id}`, { email: 'asdf@asdf.com' }) | |
> api.get('users/${id}') | |
> api.patch(`users/${id}`, { email: 'adam@asdf.com' }) | |
> api.delete(`users/${id}`) | |
*/ | |
class ApiClient { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { useEffect, useMemo, useState } from 'react' | |
import { | |
get, set, every, isPlainObject, cloneDeep, cloneDeepWith, isEqual | |
} from 'lodash' | |
import { resolver } from 'js/util/validators' | |
const parseIntOrNull = (val) => { | |
const intVal = parseInt(val) | |
return isNaN(intVal) ? null : intVal | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import axios, { CancelTokenSource } from 'axios' | |
import TokenService from './token.service' | |
export const api = axios.create({ | |
baseURL: process.env.REACT_APP_API_BASE_URL || '', | |
withCredentials: true, | |
}) | |
const requestCancelSourcesByKey: { [cancelKey: string]: CancelTokenSource } = {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Auth from '@aws-amplify/auth' | |
/** | |
USAGE: | |
> api.post(`users/${id}`, { email: 'asdf@asdf.com' }) | |
> api.get('users/${id}') | |
> api.patch(`users/${id}`, { email: 'adam@asdf.com' }) | |
> api.delete(`users/${id}`) | |
*/ | |
class ApiClient { |
OlderNewer