学习笔记jira项目21-jwt原理和auth-provide

// 在真实环境中,如果使用firebase这种第三方auth服务的话,本文件不需要开发者开发

import { User } from "types/user";

const apiUrl = process.env.REACT_APP_API_URL;

const localStorageKey = "__auth_provider_token__";

export const getToken = () => window.localStorage.getItem(localStorageKey);

export const handleUserResponse = ({ user }: { user: User }) => {
  window.localStorage.setItem(localStorageKey, user.token || "");
  return user;
};

posted @ 2022-10-07 18:44  前端导师歌谣  阅读(15)  评论(0)    收藏  举报