All files / client/src/utils getJWT.ts

62.5% Statements 5/8
50% Branches 2/4
100% Functions 1/1
62.5% Lines 5/8

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16    357x   2140x     2140x   2140x       2140x    
import { store } from "client/utils/store";
 
export const getJWT = (): string => {
  // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
  Iif (!store) {
    return "";
  }
  const state = store.getState();
  // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
  Iif (!state.login) {
    console.log("No login info in state"); // eslint-disable-line no-console
    return "invalid token";
  }
  return state.login.jwt;
};