import { NAMESPACE } from "../constants/config/storage.config";

/**
 * @description: 令牌存储服务
 * @author ChenRui
 * @date 2020/12/18 17:25
 */
class RedirectUriStore {
  private static readonly URI = NAMESPACE + "redirectUri";

  public set redirectUri(redirectUri: string | undefined) {
    if (redirectUri) {
      sessionStorage.setItem(RedirectUriStore.URI, redirectUri);
    } else {
      sessionStorage.removeItem(RedirectUriStore.URI);
    }
  }

  public get redirectUri(): string | undefined {
    return sessionStorage.getItem(RedirectUriStore.URI) || undefined;
  }
}
const redirectUriStore = new RedirectUriStore();
export { redirectUriStore };
