Skip to content

Commit

Permalink
feat: Fixes header sent from frontend package
Browse files Browse the repository at this point in the history
  • Loading branch information
ghoshnirmalya committed Apr 4, 2020
1 parent e013799 commit 530834f
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 15 deletions.
2 changes: 0 additions & 2 deletions packages/frontend/components/navbar/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ const Navbar: NextComponentType = () => {
const isAuthenticated = !!cookieParser("token");

const handleSignOut = () => {
cookieRemover("user-id");
cookieRemover("user-roles");
cookieRemover("token");

Router.push("/sign-up");
Expand Down
8 changes: 3 additions & 5 deletions packages/frontend/components/pages/sign-up/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,10 @@ const SignUp: NextPage = () => {
password,
});

cookieSetter("user-id", res.id);
cookieSetter("user-roles", res.roles);
cookieSetter("token", res.token);

if (response.ok) {
router.push("/");
cookieSetter("token", res.token);

await router.push("/");
} else {
setErrors(res.data.columns);
}
Expand Down
9 changes: 1 addition & 8 deletions packages/frontend/lib/init-apollo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,11 @@ if (!process.browser) {
const httpApiUrl = process.env.API_URL || "";
const wsApiUrl = process.env.WS_URL || "";
const token = cookieParser("token");
const userId = cookieParser("user-id");
const userRoles = cookieParser("user-roles");
const headers = {
"X-Hasura-API-Token": `Bearer ${token}`,
"X-Hasura-Admin-Secret": process.env.HASURA_ADMIN_SECRET,
"X-Hasura-User-ID": userId,
"X-Hasura-User-Roles": [userRoles],
Authorization: `Bearer ${token}`,
};

function create() {
const token = cookieParser("token");

const httpLink = new HttpLink({
uri: httpApiUrl,
credentials: "include",
Expand Down

0 comments on commit 530834f

Please sign in to comment.