const TokenKey = 'Admin-Token';

const tokenStorage = useStorage<null | string>(TokenKey, null);

export const getToken = () => tokenStorage.value;
//添加token特殊处理，没有应用到全局
export const getBearerToken = () => ({
  Authorization: tokenStorage.value ? `Bearer ${tokenStorage.value}` : undefined,
  clientid: import.meta.env.VITE_APP_CLIENT_ID,
});

export const setToken = (access_token: string) => (tokenStorage.value = access_token);

export const removeToken = () => (tokenStorage.value = null);
