Skip to content
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

Authenticate with nmdc-server backend #26

Merged
merged 12 commits into from
Feb 9, 2024
Merged

Commits on Feb 7, 2024

  1. Replace standalone api functions with singleton object pattern.

    This replaces the standalone API request functions with an NmdcServerClient class with equivalent methods. A singleton instance of this class is constructed and exported. This allows an API token to be set on this instance and all subsequent requests will use that token.
    
    These changes also add a new method for calling the `/api/me` endpoint to retrieve the current user.
    pkalita-lbl committed Feb 7, 2024
    Configuration menu
    Copy the full SHA
    8f74c53 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    a34d273 View commit details
    Browse the repository at this point in the history
  3. Add Login, Logout, and Token pages

    The Login page has a button that initiates the nmdc-server login using the @capacitor/browser plugin and a new environment variable for the server login route.
    
    The Token page is where the backend will redirect to on successful login with the API token in a query parameter. This page collects that token, places it in persistent storage, and redirects to the home page.
    
    The Logout page clears the token from persistent storage and redirects to the root page.
    pkalita-lbl committed Feb 7, 2024
    Configuration menu
    Copy the full SHA
    32f3860 View commit details
    Browse the repository at this point in the history
  4. Wrap application in new StoreProvider

    These changes wrap the main application in the new StoreProvider. The TanStack query setup has also been moved to a dedicated component so that it can use the `useStore` hook to access the store while setting up its persistence layer. Finally, the routing has also moved to a separate component where it also uses the `useStore` hook in order to decide where to redirect the root route.
    
    A new AuthRoute component has been added that can be used when registering routes that a user must be logged in (as determined by having an API token in the store) to view.
    pkalita-lbl committed Feb 7, 2024
    Configuration menu
    Copy the full SHA
    a851ec2 View commit details
    Browse the repository at this point in the history
  5. Display logged-in user on Home page

    This is mainly for demo purposes and can be removed later
    pkalita-lbl committed Feb 7, 2024
    Configuration menu
    Copy the full SHA
    2545479 View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    5372870 View commit details
    Browse the repository at this point in the history

Commits on Feb 8, 2024

  1. Replace hardcoded paths

    pkalita-lbl committed Feb 8, 2024
    Configuration menu
    Copy the full SHA
    28ee324 View commit details
    Browse the repository at this point in the history
  2. Fix typo

    pkalita-lbl committed Feb 8, 2024
    Configuration menu
    Copy the full SHA
    850b512 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    72d3a4e View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    d6ee997 View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    63a4e2f View commit details
    Browse the repository at this point in the history

Commits on Feb 9, 2024

  1. Configuration menu
    Copy the full SHA
    16b63bb View commit details
    Browse the repository at this point in the history