Skip to content

Commit

Permalink
fix ci + created register route
Browse files Browse the repository at this point in the history
  • Loading branch information
DOOduneye committed Feb 20, 2024
1 parent f86f435 commit 365da08
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions frontend/sac-mobile/services/auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,33 @@ export const loginByEmail = async (
throw new Error('Error logging in');
}
};

/**
* Registers the user with the given first name, last name, email, and password.
* @param firstName The first name of the user.
* @param lastName The last name of the user.
* @param email The email of the user.
* @param password The password of the user.
* @returns The user that was registered.
*/
export const register = async (
firstName: string,
lastName: string,
email: string,
password: string
): Promise<User> => {
try {
const response = await axios.post(`${API_BASE_URL}/users/`, {
firstName,
lastName,
email,
password,
college: 'KKCS',
year: '3',
});
return response.data;
} catch (error) {
console.error(error);
throw new Error('Error registering');
}
}

0 comments on commit 365da08

Please sign in to comment.