"use client";
import { oidcConfig } from "muzak/config/auth";
import { User } from "oidc-client-ts";

export function getUser() {
  let oidcStorage = window?.sessionStorage.getItem(
    `oidc.user:${oidcConfig.authority}:${oidcConfig.client_id}`,
  );
  if (!oidcStorage) {
    return null;
  }
  return User.fromStorageString(oidcStorage);
}
