-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into sean/fulfill
- Loading branch information
Showing
15 changed files
with
329 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ | |
align-items: center; | ||
display: flex; | ||
flex-direction: column; | ||
|
||
text-align: center; | ||
|
||
.pfp { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import { config } from '@/lib'; | ||
import type { ModifyUserAccessLevelResponse, PrivateProfile } from '@/lib/types/apiResponses'; | ||
import axios from 'axios'; | ||
|
||
/** | ||
* Update current user's access level | ||
* @param token Authorization bearer token | ||
* @param user Email of the user whose access is being updated | ||
* @param accessType The user's updated access type | ||
* @returns The updated user profile | ||
*/ | ||
export const manageUserAccess = async ( | ||
token: string, | ||
user: string, | ||
accessType: string | ||
): Promise<PrivateProfile[]> => { | ||
const accessUpdates = [{ user: user, accessType: accessType }]; | ||
|
||
const requestUrl = `${config.api.baseUrl}${config.api.endpoints.admin.access}`; | ||
|
||
const response = await axios.patch<ModifyUserAccessLevelResponse>( | ||
requestUrl, | ||
{ accessUpdates: accessUpdates }, | ||
{ | ||
headers: { | ||
Authorization: `Bearer ${token}`, | ||
}, | ||
} | ||
); | ||
|
||
return response.data.updatedUsers; | ||
}; | ||
|
||
export default manageUserAccess; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import { AdminAPI } from '@/lib/api'; | ||
import { CookieService } from '@/lib/services'; | ||
import { APIHandlerProps } from '@/lib/types'; | ||
import { UserAccessUpdates } from '@/lib/types/apiRequests'; | ||
import { PrivateProfile } from '@/lib/types/apiResponses'; | ||
import { CookieType } from '@/lib/types/enums'; | ||
|
||
const manageUserAccess = async (data: UserAccessUpdates & APIHandlerProps<PrivateProfile[]>) => { | ||
const { user, accessType, onSuccessCallback, onFailCallback } = data; | ||
|
||
try { | ||
const token = CookieService.getClientCookie(CookieType.ACCESS_TOKEN); | ||
const updatedUsers = await AdminAPI.manageUserAccess(token, user, accessType); | ||
onSuccessCallback?.(updatedUsers); | ||
} catch (e: any) { | ||
onFailCallback?.(e); | ||
} | ||
}; | ||
|
||
export default manageUserAccess; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.