jaeyun0503 commented on code in PR #4185:
URL: https://github.com/apache/texera/pull/4185#discussion_r2778312571


##########
frontend/src/app/common/service/user/auth.service.ts:
##########
@@ -177,4 +196,73 @@ export class AuthService {
   static removeAccessToken(): void {
     localStorage.removeItem(TOKEN_KEY);
   }
+
+  /**
+   * Returns true if the system needs to prompt the user with the registration 
form
+   * @param uid
+   * @private
+   */
+  private checkRegistrationRequired(uid: number): Observable<boolean> {
+    return 
this.http.get<boolean>(`${AppSettings.getApiEndpoint()}/user/joining-reason/required`,
 {
+      params: { uid: uid.toString() },
+    });
+  }
+
+  /**
+   * Submits changes to the backend with affiliation and joining reason
+   * @param uid
+   * @param affiliation
+   * @param reason
+   * @private
+   */
+  private submitRegistration(uid: number, affiliation: string, reason: 
string): Observable<void> {
+    return 
this.http.put<void>(`${AppSettings.getApiEndpoint()}/user/joining-reason`, {
+      uid,
+      affiliation,
+      joiningReason: reason,
+    });
+  }
+
+  /**
+   * Opens the registration modal (registration request modal)
+   * @param uid
+   * @param email
+   * @param defaultName
+   * @private
+   */
+  private openRegistrationModal(uid: number, email: string, defaultName: 
string): void {
+    const modalRef = this.modal.create<RegistrationRequestModalComponent>({
+      nzContent: RegistrationRequestModalComponent,
+      nzData: { uid, email, name: defaultName },
+      nzOkText: "Send request to Admin",
+      nzCancelText: "Cancel",
+      nzMaskClosable: false,
+      nzClosable: false,
+
+      nzOnOk: async () => {

Review Comment:
   I think I wanted to keep the `loginWithExistingToken` function in 
auth.service.ts as that file is mostly for authentications, while my new 
component has only the code for the UI part. I wanted to keep authentication 
logic in the auth.service.ts while keeping the UI related code in the new 
component file.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to