Skip to content
This repository was archived by the owner on Aug 29, 2025. It is now read-only.

Change all API helpers function arguments to object #11

@mittalyashu

Description

@mittalyashu

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
    }
  });
}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions