Skip to content

Commit 5656af5

Browse files
committed
cancel call
1 parent d7be819 commit 5656af5

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/api/fetchApi/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import axios from 'axios';
22
import { httpMethods } from '../constants';
3+
export const source = axios.CancelToken.source();
34

45
export const DEFAULT_HEADERS = {
56
Accept: 'application/json',
@@ -45,6 +46,7 @@ export const fetchApiWithAuthRequest = ({
4546
method: method || httpMethods.get,
4647
url,
4748
data,
49+
cancelToken: source.token,
4850
headers: {
4951
...DEFAULT_HEADERS,
5052
...headers,

0 commit comments

Comments
 (0)