feat: Add Sign-out functionality (#46)

#37 implemented the Sign-_in_ flow, but there wasn't a Sign-_out_ flow as part of that PR (aside from letting the cookie expire... or manually deleting the cookie...), which is obviously not ideal.

This PR implements a basic sign-out flow, along with a very simple user dropdown:
![2022-01-21 18 09 14](https://user-images.githubusercontent.com/88213859/150620847-94e4d22f-1dcf-451e-8b4a-cec24702ea6c.gif)

Bringing in a few pruned down components for the `<UserDropdown />` to integrate into the `<NavBar />`.

In addition, this also implements a simple back-end API for `/logout` which just clears the session token.
This commit is contained in:
Bryan
2022-01-24 17:09:39 -08:00
committed by GitHub
parent a44056cff5
commit 69d88b4a6d
20 changed files with 414 additions and 25 deletions

View File

@ -35,6 +35,7 @@ func New(options *Options) http.Handler {
})
})
r.Post("/login", users.loginWithPassword)
r.Post("/logout", users.logout)
r.Route("/users", func(r chi.Router) {
r.Post("/", users.createInitialUser)