import { storage } from '@/utils/Storage';
import { ACCESS_TOKEN, TENANT_TOKEN } from '@/store/mutation-types';

/**
 * 处理从URL获取的token并存储
 * @param token 从OAuth回调获取的token
 */

export const handleTokenFromUrl = (token: string) => {
  const ex = 30 * 24 * 60 * 60 * 1000;
  storage.set(ACCESS_TOKEN, token, ex);
  storage.set(TENANT_TOKEN, ex);
  storage.setCookie('satoken', token);
};
export default handleTokenFromUrl;
