Skip to content

Replace User Context with User machine #435

Closed
@presleyp

Description

@presleyp

In accordance with https://www.notion.so/coderhq/v2-Frontend-State-Management-APPROVED-e5ccb3c6357649f9a9dc1a1b2a1b7a99, we will use a machine to encapsulate API calls about the current user and hold user state.

  • replace UserContext with userMachine
  • refactor all checks for authentication
  • refactor SignInPage to use userMachine

Requirements:
Given a current user created in the database,

  • user can log in
  • user can log out
  • logged in user can view pages that require authentication
  • logged in user on /login gets redirected to /projects
  • logged out user cannot view pages that require authentication, and is redirected to /login. Upon logging in, the user is returned to the page they were trying to access.
  • logged out user can view /login and 404 page

Implementation goals:

Testing goals:

  • Storybook NavbarView
  • Storybook SignInForm
  • TBD mix of unit, integration, e2e tests to cover auth behavior

Metadata

Metadata

Assignees

Labels

siteArea: frontend dashboard

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions