Fix all comments

This commit is contained in:
2023-11-05 18:28:51 +07:00
parent b0dd3abf0e
commit 3f95ce8343
39 changed files with 483 additions and 443 deletions
+4 -5
View File
@@ -13,26 +13,25 @@ type TMethodRequest = 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH';
* @param method HTTP method
* @returns The status code and message from server
*/
export const sendRequest = async <T,>(
export const sendRequest = async <T>(
path: string,
method: TMethodRequest = 'GET',
body?: BodyInit,
body?: BodyInit
): Promise<TResponse<T>> => {
const response = await fetch(BASE_URL + path, {
method,
body,
headers: {
// prettier-ignore
'Accept': 'application/json',
'Content-Type': 'application/json',
},
});
const data = await response.json() as T;
const data = (await response.json()) as T;
return {
statusCode: response.status,
msg: response.statusText,
data
data,
};
};