This snippet adds a dependency on the `uuid` module, then uses it to create a UUID for unauth users that gets stored in an otherwise empty `account` cookie. We update _app to account for this change.
This refactors `setUserToken` into `accountCookie`, which just returns a cookie if it exists, and `setHeaders`, which sets the Axios header defaults.
Then, we update the calls in all the required files.
This was happening due to a combination of the useEffect not being updated properly in the New route and the state being completely reset when cleaned in the new route, including values that should persist.
- New route will reset state instead of it happening when the "New" button is clicked
- Added key to <React.Fragment> in party and new pages to force it to rerun getServerSideProps
Adding /characters, /weapons, or /summons will direct you to that tab by default, with /weapons as the default.
Clicking the segmented controller replaces the URL with the corresponding path, but doesn't push the navigation stack
This function sets axios's default headers to be included before all queries.
We need to call `setUserToken` in _app.tsx so that the defaults are set before every client-side call, and we also need to call it in every instance of `setServerSideProps`.
As a result, wherever we use `getCookies` and construct a `headers` object, we can remove it. Right now, we've only removed it on the top-level pages.