Gradebook Frontend Documentation - v0.0.0
    Preparing search index...

    Service responsible for authentication and user session management in the frontend. Handles user login, registration, token management, and profile operations.

    Index

    Constructors

    Accessors

    • get isLoggedIn(): boolean

      Checks if a user is currently logged in.

      Returns boolean

      True if the user is logged in, false otherwise

    • get userData$(): Observable<undefined | User>

      Provides an observable stream of the current user data. Used for components to react to changes in user authentication state.

      Returns Observable<undefined | User>

      An Observable of the current user data

    Methods

    • Changes a user's email address and updates the authentication token.

      Parameters

      • email: string

        Current email address of the user

      • newEmail: string

        New email address to change to

      Returns Promise<string>

      A Promise resolving with a success message or rejecting with error

    • Initiates the forgot password process.

      Parameters

      • email: string

        Email address of the user requesting password reset

      Returns Promise<string>

      A Promise resolving with a success message or rejecting with error

    • Gets the current user data as a snapshot.

      Returns undefined | User

      The current user data or undefined if not logged in

    • Authenticates a user and stores the received token.

      Parameters

      • email: string

        Email address of the user

      • password: string

        Password for authentication

      Returns Promise<void>

      A Promise resolving on successful login or rejecting with error

    • Logs out the current user by removing the token. This clears the authentication state and user data.

      Returns void

    • Updates the authentication token. Used when receiving a new token from the server after certain operations.

      Parameters

      • newToken: string

        The new JWT token to set

      Returns void

    • Registers a new user in the system.

      Parameters

      • email: string

        Email address of the user

      • firstName: string

        First name of the user

      • lastName: string

        Last name of the user

      • password: string

        Password for the account

      Returns Observable<Object>

      An Observable from the HTTP request

    • Resets a user's password using a token.

      Parameters

      • token: string

        Reset token received via email

      • password: string

        New password to set

      Returns Promise<string>

      A Promise resolving with a success message or rejecting with error