Commit graph

2 commits

Author SHA1 Message Date
d32293995b Refactor setUserToken into two methods
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.
2023-01-31 00:18:54 -08:00
a98585a334 Implement setUserToken util function
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.
2022-12-22 21:41:38 -08:00