Currently, we are passing multiple arguments to the API helper functions.
for example
export const getPublicBoards = async (page = 1, limit, sort = "desc") => {
return await axios({
method: "GET",
url: "/api/v1/boards",
params: {
page,
limit,
created: sort
}
});
};
👆 source code
As getPublicBoards function accept multiple arguments, due to confusion in which order the arguments needs to be passed, can lead to unexpected results.
In resolution of that problem, we can change the arguments to a single object.
for example
export const getPublicBoards = async ({
page = 1,
limit,
sort = "desc"
}) => {
return await axios({
method: "GET",
url: "/api/v1/boards",
params: {
page,
limit,
created: sort
}
});
}