Skip to content

INTF23 Review End Page #198

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 29 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
9c0b45f
fix login bug by removing onauthChange callback (#148) (#150)
aaggarwal10 Jun 29, 2023
37ee5dc
Add review scoring pages (#160)
simhonchourasia Jul 3, 2023
97b03ab
get jwt-decode library + create api clients for refreshign auth and s…
TW1234567 Jul 6, 2023
05950cb
[FE] Reviews - Info page (#154)
eden-chan Jul 9, 2023
781ede1
Combined all GraphQL requests for Application Table into one, cleaner…
Jul 26, 2023
5d45727
Review Page Access Verification (#163)
TW1234567 Sep 27, 2023
3dd0533
aaaaaaaaaaaaaaaa (#165)
some-molasses Oct 4, 2023
74fff95
removes console logs
HeetShah Oct 4, 2023
63a8680
Merge branch 'sa/FixAppTableGraphQL' into staging
HeetShah Oct 4, 2023
574db8d
Fix reviews for smaller screens (#166)
some-molasses Oct 4, 2023
cd465c7
adds back filters to dashboard
HeetShah Oct 13, 2023
072f5db
updates dependencies
HeetShah Oct 27, 2023
b75d066
[INTF23] updates application dashboard (#176)
Jess2772 Nov 2, 2023
2ba36dd
adding redirect in name column (#179)
aanxniee Nov 3, 2023
f455b38
[INTF23] Updates search, filtering, and sorting functionality (#180)
HeetShah Nov 6, 2023
5f5c0bd
imports queries and updates comments
HeetShah Nov 7, 2023
7b584ac
[INTF23] Update Dashboard UI (#183)
aanxniee Nov 10, 2023
76002e9
[INTF23] Updates Info Section in Review Page - Cherry-picked Version …
LucyWuu Nov 10, 2023
b70cc16
allows only BP domain google auth
HeetShah Nov 11, 2023
ae302e9
removes comment
HeetShah Nov 14, 2023
f98fe27
updates google sign in method
HeetShah Nov 14, 2023
0e42307
fixes info section bugs from cherry pick (#186)
HeetShah Nov 15, 2023
09e8b9b
[INTF23] Second choice tab (#184)
Jess2772 Nov 15, 2023
505dd17
lints (#190)
HeetShah Nov 15, 2023
b5077da
lints
HeetShah Nov 15, 2023
a2316f2
[INTF23] Review Dashboard Initial UI (#187)
aanxniee Nov 18, 2023
3a991d2
[INTF23] Updates SKL Section in Review Page (#189)
LucyWuu Nov 22, 2023
d1a2735
finish left content
LucyWuu Nov 29, 2023
931a87e
right division - comment & level assignment
LucyWuu Dec 6, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
node_modules
node_module
node_modules/fraction.js
__generated__
28 changes: 28 additions & 0 deletions APIClients/AuthAPIClient.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import { fetchGraphql } from "@utils/makegqlrequest";
import { mutations, queries } from "graphql/queries";
import BaseAPIClient from "./BaseAPIClient";

export type TokenInfo = {
accessToken: string;
refreshToken: string;
};

export type Role = "Admin" | "User";

const isAuthorizedByRole = (allowedRoles: Role[]): Promise<boolean> => {
BaseAPIClient.handleAuthRefresh();
const accessToken = localStorage.getItem("accessToken");

return fetchGraphql(queries.isAuthorizedByRole, {
accessToken,
roles: allowedRoles,
})
.then((result) => result.data.isAuthorizedByRole)
.catch(() => {
throw new Error("Auth Validation Error");
});
};

export default {
isAuthorizedByRole,
};
42 changes: 42 additions & 0 deletions APIClients/BaseAPIClient.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import { fetchGraphql } from "@utils/makegqlrequest";
import { mutations } from "graphql/queries";
import jwt_decode from "jwt-decode";

type AccessToken = {
readonly exp: number;
};

class BaseAPIClient {
static handleAuthRefresh(): void {
const accessToken = localStorage.getItem("accessToken");
const refreshToken = localStorage.getItem("refreshToken");
if (accessToken && refreshToken) {
const decodedToken = jwt_decode<AccessToken>(accessToken);
if (
decodedToken &&
decodedToken.exp <= Math.round(new Date().getTime() / 1000)
) {
fetchGraphql(mutations.refresh, {
refreshToken: localStorage.getItem("refreshToken"),
})
.then((result) => {
if (typeof result.data.refresh === "string") {
localStorage.setItem("accessToken", result.data.refresh);
}
})
.catch((e: Error) => {
// fail to refresh and de-auth user
localStorage.clear();
window.location.reload(); // refresh current page
throw new Error(
`Failed to refresh accessToken token. Cause: ${e.message}`,
);
});
}
} else {
throw new Error("No access or refresh token provided");
}
}
}

export default BaseAPIClient;
14 changes: 0 additions & 14 deletions components/admin/ApplicationDashboardTable.tsx

This file was deleted.

35 changes: 0 additions & 35 deletions components/admin/ApplicationDashboardTableTitle.tsx

This file was deleted.

Loading