Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { CopyFromOtherSessionsModalComponent } from './copy-from-other-sessions-
import { SessionPermanentDeletionConfirmModalComponent } from './session-permanent-deletion-confirm-modal/session-permanent-deletion-confirm-modal.component';
import { SessionsPermanentDeletionConfirmModalComponent } from './sessions-permanent-deletion-confirm-modal/sessions-permanent-deletion-confirm-modal.component';
import { CourseService } from '../../../services/course.service';
import { QueryParamKeys } from '../../../types/api-const';
import {
Course,
FeedbackQuestion,
Expand Down Expand Up @@ -120,7 +121,7 @@ export class InstructorSessionsPageComponent extends InstructorSessionModalPageC
}
ngOnInit(): void {
this.route.queryParams.subscribe((queryParams: Params) => {
this.courseId = queryParams['courseid'];
this.courseId = queryParams[QueryParamKeys.COURSE_ID];
});

this.isSessionEditFormExpanded = !!this.courseId;
Expand Down
9 changes: 6 additions & 3 deletions src/web/app/user-join-page.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { AuthService } from '../services/auth.service';
import { CourseService } from '../services/course.service';
import { NavigationService } from '../services/navigation.service';
import { SimpleModalService } from '../services/simple-modal.service';
import { QueryParamKeys } from '../types/api-const';
import { AuthInfo, CourseJoinKeyAccess, CourseJoinKeyAccessDecision } from '../types/api-output';
import { LoadingSpinnerDirective } from './components/loading-spinner/loading-spinner.directive';

Expand Down Expand Up @@ -37,13 +38,13 @@ export class UserJoinPageComponent implements OnInit {
ngOnInit(): void {
this.route.queryParams.subscribe((queryParams: Params) => {
this.entityType = queryParams['entityType'];
this.key = queryParams['key'];
this.key = queryParams[QueryParamKeys.KEY];

const nextUrl = `${globalThis.location.pathname}${globalThis.location.search.replaceAll('&', '%26')}`;
this.authService.getAuthUser().subscribe((auth: AuthInfo) => {
if (!auth.user) {
this.isLoading = false;
this.navigationService.navigateByURL(`/web/login?nextUrl=${encodeURIComponent(nextUrl)}`);
this.navigationService.navigateByURL(`/web/login?${QueryParamKeys.NEXT_URL}=${encodeURIComponent(nextUrl)}`);
return;
}
this.accountEmail = auth.user.accountEmail;
Expand All @@ -55,7 +56,9 @@ export class UserJoinPageComponent implements OnInit {
this.navigationService.navigateByURL(`/web/${this.entityType}`);
break;
case CourseJoinKeyAccessDecision.SIGN_IN_REQUIRED:
this.navigationService.navigateByURL(`/web/login?nextUrl=${encodeURIComponent(nextUrl)}`);
this.navigationService.navigateByURL(
`/web/login?${QueryParamKeys.NEXT_URL}=${encodeURIComponent(nextUrl)}`,
);
break;
case CourseJoinKeyAccessDecision.VALID:
this.hasJoined = false;
Expand Down
2 changes: 1 addition & 1 deletion src/web/services/account.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ export class AccountService {
paramMap['instituteid'] = queryParams.instituteId;
}
if (queryParams.accountId) {
paramMap['accountid'] = queryParams.accountId;
paramMap[QueryParamKeys.ACCOUNT_ID] = queryParams.accountId;
}
if (queryParams.status) {
paramMap['status'] = queryParams.status;
Expand Down
4 changes: 2 additions & 2 deletions src/web/services/institute.service.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Injectable, inject } from '@angular/core';
import { Observable } from 'rxjs';
import { HttpRequestService } from './http-request.service';
import { ResourceEndpoints } from '../types/api-const';
import { QueryParamKeys, ResourceEndpoints } from '../types/api-const';
import { Institutes } from '../types/api-output';

/**
Expand All @@ -17,6 +17,6 @@ export class InstituteService {
* Gets the institutes for which the given account has been verified.
*/
getVerifiedInstitutes(accountId: string): Observable<Institutes> {
return this.httpRequestService.get(ResourceEndpoints.INSTITUTES, { accountid: accountId });
return this.httpRequestService.get(ResourceEndpoints.INSTITUTES, { [QueryParamKeys.ACCOUNT_ID]: accountId });
}
}
2 changes: 1 addition & 1 deletion src/web/services/instructor.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ export class InstructorService {
if ('courseId' in queryParams) {
paramMap[QueryParamKeys.COURSE_ID] = queryParams.courseId;
} else {
paramMap['userid'] = queryParams.userId;
paramMap[QueryParamKeys.USER_ID] = queryParams.userId;
}

return this.httpRequestService.get(ResourceEndpoints.INSTRUCTOR_PRIVILEGE, paramMap);
Expand Down
2 changes: 1 addition & 1 deletion src/web/services/log.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ export class LogService {
};

if (queryParams.userId) {
paramMap['userid'] = queryParams.userId;
paramMap[QueryParamKeys.USER_ID] = queryParams.userId;
}

if (queryParams.sessionId) {
Expand Down
2 changes: 1 addition & 1 deletion src/web/services/student.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export class StudentService {
const paramsMap: { [key: string]: string | string[] } = {};

if (queryParams.courseIds !== undefined) {
paramsMap['courseid'] = queryParams.courseIds;
paramsMap[QueryParamKeys.COURSE_ID] = queryParams.courseIds;
}
if (queryParams.searchKey !== undefined) {
paramsMap[QueryParamKeys.SEARCH_KEY] = queryParams.searchKey;
Expand Down
Loading