Next.js template
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

accountRequests.js 489B

12345678910111213141516171819
  1. import apiEndpoints from "./apiEndpoints";
  2. export const createUser = async (fullName, username, email, password) => {
  3. const response = await fetch(apiEndpoints.account.createUser, {
  4. method: "POST",
  5. body: JSON.stringify({ fullName, username, email, password }),
  6. headers: {
  7. "Content-Type": "application/json",
  8. },
  9. });
  10. const data = await response.json();
  11. if (!response.ok) {
  12. throw new Error(data.message || "Something went wrong!");
  13. }
  14. return data;
  15. };