Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

front: 잘못된 정보 표현 수정 및 사용자 경험 개선 #320

Merged
merged 19 commits into from
Aug 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
a4f721e
feat: 경매 가격 경신 로직 수정
chhs2131 Aug 26, 2024
4dd3f98
fix: 경매 가격 하락 로직 수정
chhs2131 Aug 26, 2024
0bc6b50
feat: 재고 수량을 폴링하는 로직 추가 (시연용)
chhs2131 Aug 26, 2024
dca5dc1
feat: 정말로 로그아웃할까요? 문구 추가
chhs2131 Aug 26, 2024
bc89efa
feat: 경매 입찰 성공을 시각적으로 표시. 및 따닥 방지
chhs2131 Aug 26, 2024
b1013f4
style: list 미리보기 이미지 수정
chhs2131 Aug 26, 2024
b93e9ab
style: 목록에서는 현재가격을 추정할 수 없으므로 '시작 가격'으로 문구 변경
chhs2131 Aug 26, 2024
deea588
feat: 타이머를 통해 다음 가격 변동 시점을 노출
chhs2131 Aug 26, 2024
f886028
feat: 회원가입 시 아이디, 패스워드 규격을 사용자에게 안내한다.
chhs2131 Aug 27, 2024
9e53fac
feat: API 요청 실패 시, 일부 케이스에서 서버가 전달한 메세지를 표시
chhs2131 Aug 27, 2024
622c480
feat: 활성항목을 리스트에 표시
chhs2131 Aug 27, 2024
5f1e26a
refactor: 진행 중인 경매에 색상을 표시한다.
chhs2131 Aug 27, 2024
b6c02ca
feat: 회원가입 성공시 성공 멘트 표시
chhs2131 Aug 27, 2024
1981b76
refactor: 거래내역에서 생성일과 수정일을 표시하지 않습니다. (서버에서 생성하지 않음)
chhs2131 Aug 27, 2024
12fd1d4
refactor: 판매자 가입 기능 제거
chhs2131 Aug 27, 2024
5861624
fix: 경매 상세페이지에서 가격을 갱신하는 타이머 오류 수정
chhs2131 Aug 27, 2024
54a297c
fix: 종료된 경매에서 입찰버튼이 활성화되던 문제 수정
chhs2131 Aug 27, 2024
0d2789b
Merge branch 'dev' into feat/307-front
minseok-oh Aug 27, 2024
d3c2ff6
Merge branch 'dev' into feat/307-front
minseok-oh Aug 27, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions front/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions front/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"@types/react": "^18.3.1",
"@types/react-dom": "^18.3.0",
"react": "^18.3.1",
"react-confetti": "^6.1.0",
"react-dom": "^18.3.1",
"react-scripts": "5.0.1",
"typescript": "^4.9.5",
Expand Down
14 changes: 8 additions & 6 deletions front/src/api/auction/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ async function requestAuctionDetail(
baseUrl: string,
auctionId: number,
onSuccess: (auctionDetail: AuctionDetailItem) => void,
onFailure: () => void
onFailure: (message: string) => void
) {
try {
const response = await fetch(`${baseUrl}/auctions/${auctionId}`, {
Expand All @@ -45,11 +45,12 @@ async function requestAuctionDetail(
const auctionDetail: AuctionDetailItem = await response.json();
onSuccess(auctionDetail);
} else {
onFailure();
const errorMessage = await response.text();
onFailure(errorMessage);
}
} catch (error) {
console.error('Failed to fetch auction detail.', error);
onFailure();
onFailure("REQUEST AUCTION DETAIL.");
}
}

Expand All @@ -58,7 +59,7 @@ async function requestAuctionBid(
auctionId: number,
request: AuctionPurchaseRequest,
onSuccess: () => void,
onFailure: () => void
onFailure: (message: string) => void
) {
try {
const response = await fetch(`${baseUrl}/auctions/${auctionId}/purchase`, {
Expand All @@ -78,12 +79,13 @@ async function requestAuctionBid(
if (response.ok) {
onSuccess();
} else {
onFailure();
const errorMessage = await response.text();
onFailure(errorMessage);
}

} catch (error) {
console.error('Failed to bid auction.', error);
onFailure();
onFailure("BID REQUEST FAILED");
}
}

Expand Down
7 changes: 4 additions & 3 deletions front/src/api/payments/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ async function chargePointsApi(
baseUrl: string,
data: ChargePointsRequest,
onSuccess: () => void,
onFailure: () => void
onFailure: (message: string) => void
) {
try {
const response = await fetch(`${baseUrl}/payments/points/charge`, {
Expand All @@ -21,10 +21,11 @@ async function chargePointsApi(
if (response.ok) {
onSuccess();
} else {
onFailure();
const errorMessage = await response.text();
onFailure(errorMessage);
}
} catch (error) {
onFailure();
onFailure("CHARGE POINT ERROR.");
}
}

Expand Down
7 changes: 4 additions & 3 deletions front/src/api/receipt/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ async function requestRefund(
baseUrl: string,
receiptId: number,
onSuccess: () => void,
onFailure: () => void
onFailure: (message: string) => void
) {
try {
const response = await fetch(`${baseUrl}/receipts/${receiptId}/refund`, {
Expand All @@ -76,10 +76,11 @@ async function requestRefund(
if (response.ok) {
onSuccess();
} else {
onFailure();
const errorMessage = await response.text();
onFailure(errorMessage);
}
} catch (error) {
onFailure();
onFailure("REQUEST REFUND ERROR");
}
}

Expand Down
28 changes: 17 additions & 11 deletions front/src/api/user/api.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import {SignInRequest, SignUpRequest} from "./type";
import { SignInRequest, SignUpRequest } from "./type";

async function signUpApi(
baseUrl: string,
data: SignUpRequest,
onSuccess: () => void,
onFailure: () => void
onFailure: (message: string) => void
) {
try {
const response = await fetch(`${baseUrl}/auth/signup`, {
Expand All @@ -18,18 +18,20 @@ async function signUpApi(
if (response.ok) {
onSuccess();
} else {
onFailure();
const errorMessage = await response.text();
onFailure(`Sign up failed: ${errorMessage}`);
}
} catch (error) {
onFailure();
console.error(error);
onFailure("An unexpected error occurred during sign-up.");
}
}

async function signInApi(
baseUrl: string,
data: SignInRequest,
onSuccess: () => void,
onFailure: () => void
onFailure: (message: string) => void
) {
try {
const response = await fetch(`${baseUrl}/auth/signin`, {
Expand All @@ -41,21 +43,23 @@ async function signInApi(
},
body: JSON.stringify(data),
});

if (response.ok) {
onSuccess();
} else {
onFailure();
const errorMessage = await response.text();
onFailure(`Sign in failed: ${errorMessage}`);
}
} catch (error) {
console.error(error);
onFailure();
onFailure("An unexpected error occurred during sign-in.");
}
}

async function signOut(
baseUrl: string,
onSuccess: () => void,
onFailure: () => void
onFailure: (message: string) => void
) {
try {
const response = await fetch(`${baseUrl}/auth/signout`, {
Expand All @@ -70,11 +74,13 @@ async function signOut(
if (response.ok) {
onSuccess();
} else {
onFailure();
const errorMessage = await response.text();
onFailure(`Sign out failed: ${errorMessage}`);
}
} catch (error) {
onFailure();
console.error(error);
onFailure("An unexpected error occurred during sign-out.");
}
}

export {signUpApi, signInApi, signOut};
export { signUpApi, signInApi, signOut };
4 changes: 2 additions & 2 deletions front/src/pages/ChargePoint.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ function ChargePointPage() {
showAlert("포인트 충전 성공!")
setRequest({amount: 0});
},
() => {
showAlert("포인트 충전 실패!")
(message) => {
showAlert("포인트 충전 실패! " + message)
}
);
}
Expand Down
9 changes: 8 additions & 1 deletion front/src/pages/Footer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,11 @@ import creditCardIcon from '../img/credit-card.svg';
import listIcon from '../img/list.svg';
import logInIcon from '../img/log-in.svg';
import logOutIcon from '../img/log-out.svg';
import useAlert from "../hooks/useAlert";

function Footer() {
const {showAlert} = useAlert();

const { currentPage, setPage } = usePageStore();
const { isLogin, setIsLogin } = useLoginStore();
const baseUrl = process.env.REACT_APP_API_URL || '';
Expand All @@ -18,14 +21,18 @@ function Footer() {
};

const logout = () => {
if(!window.confirm("정말로 로그아웃할까요?")) {
return;
}
signOut(
baseUrl,
() => {
setIsLogin(false);
setPage('home');
},
() => {
(message) => {
console.log('Failed to sign out.');
showAlert(message);
}
);
};
Expand Down
4 changes: 2 additions & 2 deletions front/src/pages/Login.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ function LoginPage() {
setIsLogin(true);
showAlert('로그인 성공하였습니다.');
},
() => {
(response) => {
setIsLogin(false);
showAlert('로그인에 실패하였습니다.');
showAlert(response);
setRequest({signInId: '', password: ''});
}
);
Expand Down
Loading
Loading