accidentally made the hook a function call rather than having it return a fumnction... (#41)

This commit is contained in:
Axel Adlercreutz
2025-02-03 13:00:40 +02:00
committed by GitHub
parent f68fd577ae
commit 96ab39f77e
+10 -10
View File
@@ -7,16 +7,16 @@ const defaultConfig = {
},
};
/**
* @description This hook is used to make a request to the server.
* Mainly used for non-GET requests.
* @param {string} url - The URL to make the request to.
* @param {Object} body - The body of the request.
* @param {Object} config - The config of the request.
* @returns {Object} - The response from the server.
*/
export const useRequest = (url, body, config) => {
return axiosInstance.request({
export const useRequest = () => {
/**
* @description This hook is used to make a request to the server.
* Mainly used for non-GET requests.
* @param {string} url - The URL to make the request to.
* @param {Object} body - The body of the request.
* @param {Object} config - The config of the request.
* @returns {Object} - The response from the server.
*/
return (url, body, config) => axiosInstance.request({
url,
data: body,
...defaultConfig,