mirror of
https://github.com/Nezumi-2711/react-training.git
synced 2026-09-23 04:19:48 +00:00
Remove unnecessary code
This commit is contained in:
@@ -8,6 +8,4 @@ const ERROR_MSG = (errorCode: number, msg: string) => {
|
|||||||
return `Error code: ${errorCode}. Message: ${msg}`;
|
return `Error code: ${errorCode}. Message: ${msg}`;
|
||||||
};
|
};
|
||||||
|
|
||||||
const TIME_OUT_MSG = 'Connection time out!';
|
export { INVALID_FORMAT_MSG, ADD_SUCCESS, ERROR_MSG };
|
||||||
|
|
||||||
export { INVALID_FORMAT_MSG, ADD_SUCCESS, ERROR_MSG, TIME_OUT_MSG };
|
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
const STATUS_CODE = {
|
const STATUS_CODE = {
|
||||||
CREATE: 201,
|
CREATE: 201,
|
||||||
NOT_FOUND: 404,
|
NOT_FOUND: 404,
|
||||||
CONNECTION_TIME_OUT: 522,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export { STATUS_CODE };
|
export { STATUS_CODE };
|
||||||
|
|||||||
@@ -8,9 +8,6 @@ export const sendRequest = async (
|
|||||||
body: BodyInit | null | undefined,
|
body: BodyInit | null | undefined,
|
||||||
method: TMethodRequest = 'GET',
|
method: TMethodRequest = 'GET',
|
||||||
): Promise<TResponse> => {
|
): Promise<TResponse> => {
|
||||||
const controller = new AbortController();
|
|
||||||
const signal = controller.signal;
|
|
||||||
|
|
||||||
const response = await fetch(BASE_URL + path, {
|
const response = await fetch(BASE_URL + path, {
|
||||||
method,
|
method,
|
||||||
body,
|
body,
|
||||||
@@ -19,7 +16,6 @@ export const sendRequest = async (
|
|||||||
'Accept': 'application/json',
|
'Accept': 'application/json',
|
||||||
'Content-Type': 'application/json',
|
'Content-Type': 'application/json',
|
||||||
},
|
},
|
||||||
signal,
|
|
||||||
});
|
});
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
|||||||
Reference in New Issue
Block a user