Skip to content

Commit

Permalink
Merge pull request #58 from brandonnorsworthy/guest-auth
Browse files Browse the repository at this point in the history
Added service calls for logging in and registering a guest
  • Loading branch information
JeredSpears authored Sep 15, 2024
2 parents 0703919 + 12b4281 commit 37c07ac
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions src/service/authService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,23 @@ export default {
}
}) as Promise<RegisterResponse>,

/**
* register a new guest user
* @param accessToken
* @param username
* @param password
* @returns a promise that resolves to the response from the server
*/
registerGuest: async (accessToken: string, username: string, password: string) => await sendRequest({
method: 'POST',
endpoint: '/auth/register-guest',
accessToken,
body: {
username,
password
}
}) as Promise<RegisterResponse>,

/**
* login a user
* @param username
Expand All @@ -33,6 +50,15 @@ export default {
}
}) as Promise<LoginResponse>,

/**
* login a guest user
* @returns a promise that resolves to the response from the server
*/
guestLogin: async () => await sendRequest({
method: 'POST',
endpoint: '/auth/login-guest',
}) as Promise<LoginResponse>,

refreshToken: async (accessToken: string) => await sendRequest({
method: 'POST',
endpoint: '/auth/token',
Expand Down

0 comments on commit 37c07ac

Please sign in to comment.