Skip to content

Commit

Permalink
(Team-Coverflow#329)style: 상점 방문 시 에러 토스트 발생하도록 수정했습니다.
Browse files Browse the repository at this point in the history
  • Loading branch information
JayJayleee committed May 13, 2024
1 parent e573b1c commit 3158153
Show file tree
Hide file tree
Showing 6 changed files with 43 additions and 21 deletions.
2 changes: 1 addition & 1 deletion src/asset/sass/pages/storePage/storePage.scss
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

.fish-disclaimer {
font-family: 'Pretendard-bold';
font-size: 1.2rem;
font-size: 3rem;
color: black;
padding-top: 1rem;
letter-spacing: -1px;
Expand Down
3 changes: 2 additions & 1 deletion src/components/pages/myPage/myPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,8 @@ function Mypage() {
// navigate('/premium');
};
const goToStore = () => {
navigate('/store');
// navigate('/store');
showErrorToast("준비중인 페이지입니다.")
};
const goToEdit = () => {
navigate('/info-edit', { state: { nickname } });
Expand Down
28 changes: 15 additions & 13 deletions src/components/pages/storePage/storePage.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useState, useEffect } from 'react';
import React, { useEffect } from 'react';
import { useNavigate } from 'react-router-dom';
import '../../../asset/sass/pages/storePage/storePage.scss';

Expand All @@ -11,17 +11,18 @@ import { CurrentFishBanner } from '../../ui/banner/currentFishBanner';
import { ACCESS_TOKEN } from '../../global/constants';
import FishListItem from '../../ui/selection/fishListItem.tsx';
import UserInfoHeader from '../../ui/header/userInfoHeader.jsx';
import { showErrorToast } from '../../ui/toast/toast.tsx';

function StorePage() {
const navigate = useNavigate();
const [purchaseList, setPurchaseList] = useState([
{ fishShapeBun: 0, price: 0, cnt: 0, date: '' },
]);
// const [purchaseList, setPurchaseList] = useState([
// { fishShapeBun: 0, price: 0, cnt: 0, date: '' },
// ]);
useEffect(() => {
setPurchaseList(() => [
{ fishShapeBun: 200, price: 2000, cnt: 2, date: '2024-03-02' },
{ fishShapeBun: 200, price: 2000, cnt: 2, date: '2024-03-02' },
]);
// setPurchaseList(() => [
// { fishShapeBun: 200, price: 2000, cnt: 2, date: '2024-03-02' },
// { fishShapeBun: 200, price: 2000, cnt: 2, date: '2024-03-02' },
// ]);

const token = localStorage.getItem(ACCESS_TOKEN);

Expand All @@ -35,7 +36,8 @@ function StorePage() {
};

const goWIL = () => {
navigate('/work-progress');
showErrorToast("현재 준비중이에요")
// navigate('/work-progress');
};

return (
Expand Down Expand Up @@ -63,8 +65,8 @@ function StorePage() {
<div className="store-wrapper">
<CurrentFishBanner />

{purchaseList.length > 0 ? (
<div className="fish-purchase-list">
{/* {purchaseList.length > 0 ? ( */}
{/* <div className="fish-purchase-list">
{purchaseList.map((item, index) => (
<div key={index} className="fish-purchase-item">
<div>
Expand All @@ -81,7 +83,7 @@ function StorePage() {
</div>
))}
</div>
) : (
) : ( */}
<div className="no-fish-purchase">
<img
src={FaceIcon}
Expand All @@ -90,7 +92,7 @@ function StorePage() {
/>
<span className="fish-disclaimer">구매 내역이 없어요</span>
</div>
)}
{/* )} */}
</div>
</SelectSlider>
</div>
Expand Down
24 changes: 20 additions & 4 deletions src/components/pages/termsPage/termsPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -107,26 +107,42 @@ export default function TermsPage() {
// =========================================================== 토큰 발급을 위한 부분

const fetchToken = async (code: string): Promise<Headers> => {
if (!code) throw new Error('Code is required');
const response = await fetch(`${BASE_URL}/api/auth/token?code=${code}`, {
if (!code) throw new Error('No Code');

let queryParams = `code=${code}`;

if (termsAgreement.term6) {
queryParams += '&agreeMarketing=true';
}
if (termsAgreement.term7) {
queryParams += '&agreeCollection=true';
}
const url = `${BASE_URL}/api/auth/token?${queryParams}`;


const response = await fetch(url, {
method: 'GET',
headers: {
'Content-Type': 'application/json',
},
});

if (!response.ok) {
throw new Error(`HTTP error! status: ${response.status}`);
throw new Error(`${response.status}`);
}

return response.headers;
};


const agreeToTerms = async (): Promise<void> => {
try {
if (
!termsAgreement.term1 ||
!termsAgreement.term2 ||
!termsAgreement.term3 ||
!termsAgreement.term4
!termsAgreement.term4 ||
!termsAgreement.term5
) {
showErrorToast('필수 약관에 동의해주세요.');
}
Expand Down
4 changes: 3 additions & 1 deletion src/components/ui/header/userInfoHeader.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import {
} from '../../../store/actions/userActions';
import { alertCount } from '../../../store/actions/alertActions.js';
import { ACCESS_TOKEN, REFRESH_TOKEN } from '../../global/constants/index.ts';
import { showErrorToast } from '../toast/toast.tsx';

function UserInfoHeader() {
const { isLoggedIn, rewardCount, isDropdownOpen } = useSelector(
Expand Down Expand Up @@ -70,7 +71,8 @@ function UserInfoHeader() {

/* 붕어빵 아이콘을 클릭했을 경우, 상점으로 이동합니다. */
const handleRewardClick = () => {
navigate('/store');
// navigate('/store');
showErrorToast("준비중인 페이지입니다.")
};

/*
Expand Down
3 changes: 2 additions & 1 deletion src/components/ui/myPageSelection/myAnswer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -100,12 +100,13 @@ export default function MyAnswer({
className="my-component-css"
/>
)}

{answer.length >= 1 && (
<AdminPagination
currentPage={currentPage}
totalPages={totalPages}
handlePagination={handlePagination}
/>
)}
</div>
);
}

0 comments on commit 3158153

Please sign in to comment.