import { TextUtil } from "@greatness/util";
import Cookies from "js-cookie";

export interface AccessToken {
  accessToken?: string;
}

export default class JWTUtil {
  public static get(): AccessToken {
    return {
      accessToken: Cookies.get("accessToken"),
    };
  }

  public static set({ accessToken }: AccessToken): void {
    if (!TextUtil.isEmpty(accessToken)) {
      Cookies.set("accessToken", accessToken!);
    }
  }

  public static unset(): void {
    Cookies.remove("accessToken");
  }
};
