Skip to content

Commit

Permalink
MV2: api - handle missing cookies gracefully
Browse files Browse the repository at this point in the history
fix #954
  • Loading branch information
chrmod authored and philipp-classen committed Dec 13, 2022
1 parent c2e0d70 commit 9f5abdc
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions extension-manifest-v2/src/utils/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,11 @@ class Api {

const pending = (async () => {
const fromCookie = async (name) => {
const { value } = await cookiesGet({ name });
if (!value) {
const cookie = await cookiesGet({ name });
if (!cookie || !cookie.value) {
throw new Error(`Unable to refreshToken without "${name}"`);
}
return value;
return cookie.value;
};
const headers = {
UserId: await fromCookie('user_id'),
Expand Down

0 comments on commit 9f5abdc

Please sign in to comment.