Skip to content

Commit

Permalink
[feat]유저 정보 갱신 #54
Browse files Browse the repository at this point in the history
  • Loading branch information
HyeongwooIM committed Apr 24, 2023
1 parent 1792a8f commit cd5ec9b
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ import LoginCheck from "./components/login/LoginCheck";

const App = () => {
// const navigate = useNavigate();
// const baseUrl = `${process.env.REACT_APP_END_POINT}`;
const baseUrl = `${process.env.REACT_APP_END_POINT}`;
// const [isLogged, setIsLogged] = useState(false);
// const [userInfo, setUserInfo] = useRecoilState(profileState);
const [userInfo, setUserInfo] = useRecoilState(profileState);
// const url = new URL(window.location.href);
// const href = url.href;
// const accessToken = href.split("token=")[1];
Expand Down Expand Up @@ -70,6 +70,18 @@ const App = () => {
// const url = new URL(window.location.href);
// const href = url.href;
// const accessToken = href.split("token=")[1];
useEffect(()=>{
fetch(`${baseUrl}/user/me`, {
headers: {
Authorization: `Bearer ${localStorage.getItem("42ence-token")}`,
}
})
.then((res) => res.json())
.then((data) => setUserInfo(data));
console.log(userInfo.level)
}
,[])


return (
<>
Expand Down

0 comments on commit cd5ec9b

Please sign in to comment.