Skip to content

Commit

Permalink
hotfix: 로그아웃 post 데이터 타입 변경 (#468)
Browse files Browse the repository at this point in the history
  • Loading branch information
jiwonh423 authored Sep 20, 2023
1 parent a126c4b commit 2726581
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions frontend/src/components/MyInfo/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { ProfileProps } from '../../types/Profile';
import UpdateMyInfo from './UpdateMyInfo';
import Button from '../common/Button';
import useToast from '../../hooks/useToast';
import { postApi } from '../../apis/postApi';
import { DEFAULT_PROD_URL } from '../../constants';

const user = JSON.parse(localStorage.getItem('user') || '{}');
const accessToken = localStorage.getItem('userToken');
Expand All @@ -25,13 +25,16 @@ const MyInfo = () => {

const onClickLogout = async (e: React.MouseEvent<HTMLButtonElement>) => {
try {
await postApi(
`/logout`,
{
accessToken: accessToken,
fetch(`${DEFAULT_PROD_URL}/logout`, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
Authorization: `Bearer ${accessToken}`,
},
'x-www-form-urlencoded',
);
body: JSON.stringify({
accessToken: accessToken,
}),
});

localStorage.removeItem('user');
localStorage.removeItem('userToken');
Expand Down

0 comments on commit 2726581

Please sign in to comment.