Skip to content

Commit 753ef96

Browse files
committed
adding comments
1 parent a8f51b9 commit 753ef96

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

src/frontend/src/pages/LoginPage/Login.tsx

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ import { useQuery } from '../../hooks/utils.hooks';
1313
import { useOrganization } from '../../hooks/organizations.hooks';
1414
import { CredentialResponse } from '@react-oauth/google';
1515

16+
/**
17+
* Page for unauthenticated users to do login.
18+
*/
1619
const Login = () => {
1720
const [devUserId, setDevUserId] = useState('');
1821
const history = useHistory();
@@ -21,10 +24,16 @@ const Login = () => {
2124
const auth = useAuth();
2225
const organizationContext = useOrganization();
2326

27+
/**
28+
* Produce the path of the page redirected from the login page.
29+
* @param queryArgs the query args sent from the login page, containing page, value1, value2, ..., and other args
30+
* @returns the path, with args, redirected to
31+
*/
2432
const redirectQueryArgsToPath = (queryArgs: URLSearchParams): string => {
2533
const pageName: string = queryArgs.get('page')!;
2634
queryArgs.delete('page');
2735

36+
// collect all the &valueX=... args, in order, from login query args
2837
const intermediatePathValues: string[] = [];
2938
for (let valueIdx = 1; queryArgs.has(`value${valueIdx}`); valueIdx++) {
3039
intermediatePathValues.push(`/${queryArgs.get(`value${valueIdx}`)!}`);

0 commit comments

Comments
 (0)