Skip to content

Commit

Permalink
Merge pull request #324 from JayJayleee/feat/#285-ui-check-list
Browse files Browse the repository at this point in the history
νƒˆν‡΄ 둜직 μˆ˜μ •ν–ˆμŠ΅λ‹ˆλ‹€.
  • Loading branch information
JayJayleee committed May 11, 2024
2 parents 34e146f + 86e4649 commit f281496
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 6 deletions.
5 changes: 1 addition & 4 deletions src/components/global/token/tokenManagement.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const fetchToken = async (code) => {
'Content-Type': 'application/json',
},
});
console.log(response);

if (!response.ok) {
throw new Error(`HTTP error! status: ${response.status}`);
}
Expand All @@ -44,13 +44,11 @@ const TokenManagement = () => {
console.log('role:', role);

if (!code || !role) {
console.error('μ½”λ“œ λ˜λŠ” 역할이 URL에 ν¬ν•¨λ˜μ–΄ μžˆμ§€ μ•ŠμŠ΅λ‹ˆλ‹€.');
navigate('/login');
return;
}

if (role === 'GUEST') {
console.log('μ•½κ΄€ λ™μ˜ νŽ˜μ΄μ§€λ‘œ μ΄λ™ν•©λ‹ˆλ‹€.');
navigate('/login/terms', { state: {code} });
} else {
fetchToken(code)
Expand All @@ -70,7 +68,6 @@ const TokenManagement = () => {
const decoded = decodeToken(accessToken);

if (['MEMBER', 'PREMIUM', 'ADMIN'].includes(decoded.role)) {
console.log('νšŒμ› 정보가 μ‘΄μž¬ν•©λ‹ˆλ‹€. 메인 νŽ˜μ΄μ§€λ‘œ μ΄λ™ν•©λ‹ˆλ‹€.');
navigate(prevPage || '/');
initializeSSE(queryClient, dispatch);
} else {
Expand Down
11 changes: 10 additions & 1 deletion src/components/pages/myPage/secessionPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ import TabBar from '../../ui/tabBar/tabBar';
import SecessionWarning from '../../../asset/image/secessionWarning.svg';
import { fetchAPI } from '../../global/utils/apiUtil.js';
import { showErrorToast, showSuccessToast } from '../../ui/toast/toast.tsx';
import {ACCESS_TOKEN, REFRESH_TOKEN} from '../../global/constants/index.ts'
import {alertCount} from '../../../store/actions/alertActions.js'
import { useDispatch } from 'react-redux';
import {setLoggedIn} from'../../../store/actions/userActions';

const Divider = styled.div`
height: 0.3rem;
Expand All @@ -20,6 +24,7 @@ const Divider = styled.div`
function SecessionPage() {
const navigate = useNavigate();
const location = useLocation();
const dispatch = useDispatch();
const { nickname } = location.state as { nickname: string };
const [isAgreed, setIsAgreed] = useState(false);
const [secessionReason, setSecessionReason] = useState('');
Expand Down Expand Up @@ -49,7 +54,11 @@ function SecessionPage() {
try {
await fetchAPI('/api/member/leave', 'DELETE');
showSuccessToast('μ„±κ³΅μ μœΌλ‘œ νƒˆν‡΄ μ²˜λ¦¬λ˜μ—ˆμŠ΅λ‹ˆλ‹€.');
navigate('/');
localStorage.removeItem(ACCESS_TOKEN);
localStorage.removeItem(REFRESH_TOKEN);
dispatch(setLoggedIn(false));
dispatch(alertCount(0));
navigate('/secessionComplete-page');
} catch (error) {
showErrorToast(`νƒˆν‡΄ 처리 쀑 였λ₯˜κ°€ λ°œμƒν–ˆμŠ΅λ‹ˆλ‹€: ${error}`);
}
Expand Down
2 changes: 1 addition & 1 deletion src/components/pages/termsPage/termsPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export default function TermsPage() {
const queryClient = useQueryClient();
const dispatch = useDispatch();
const { code } = location.state as LocationState;
console.log("μ½”λ“œ",code)

// =========================================================== μ•½κ΄€ λ™μ˜ 확인을 μœ„ν•œ λΆ€λΆ„
const [allAgreed, setAllAgreed] = useState<boolean>(false);
const [termsAgreement, setTermsAgreement] = useState<TermsAgreement>({
Expand Down

0 comments on commit f281496

Please sign in to comment.