mirror of
https://github.com/headporter81/ss-front-react.git
synced 2026-12-06 07:41:11 +09:00
feat : BBS 게시판 탭·모바일 제스처 추가, 로그인 유지 및 뒤로가기 새로고침 버그 수정
SpecialSource Frontend (React) CD / deploy (push) Successful in 15s
SpecialSource Frontend (React) CD / deploy (push) Successful in 15s
- 로그인 토큰을 sessionStorage에 보관해 새로고침해도 로그인 유지 - 메인 화면에서 L이 로그아웃되던 문제 수정 (L = 목록으로 통일) - 게시판 목록을 번호/게시판/제목/날짜(YYYYMMDD) 레이아웃으로 변경 - 게시판 종류별 탭 추가 (클릭 또는 B번호 입력, /boards API 사용) - 모바일 제스처: 좌우 스와이프로 뒤로/앞으로, 당겨서 목록 새로고침 - 뒤로가기 시 Next.js가 페이지를 새로고침해 메인으로 튕기던 버그 수정 - study-notes 5번 정정 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
523b90be15
commit
8914954c55
9 files changed
+173
-40
No files matched your search
@@ -1,4 +1,4 @@
|
||||
import type { Feed, ListKind } from "./types";
|
||||
import type { Board, Feed, ListKind } from "./types";
|
||||
|
||||
// 개발은 로컬 백엔드 직접 호출, 운영(nginx)은 같은 도메인의 /api 프록시. NEXT_PUBLIC_API_URL로 덮어쓰기 가능
|
||||
export const API_URL =
|
||||
@@ -15,11 +15,15 @@ async function call(path: string, token: string, init?: RequestInit) {
|
||||
}
|
||||
|
||||
// ponytail: 첫 페이지 30건만 가져옴. 페이지 넘김이 필요해지면 page 파라미터 추가
|
||||
export async function fetchFeed(token: string, kind: ListKind): Promise<Feed> {
|
||||
const res = await call(`/api/scraped-posts${kind === "viewed" ? "/viewed" : ""}?size=30`, token);
|
||||
export async function fetchFeed(token: string, kind: ListKind, board: string | null): Promise<Feed> {
|
||||
const filter = board ? `&board=${encodeURIComponent(board)}` : "";
|
||||
const res = await call(`/api/scraped-posts${kind === "viewed" ? "/viewed" : ""}?size=30${filter}`, token);
|
||||
const data = await res.json(); // Spring Page 응답: { content: [...], totalElements, ... }
|
||||
return { kind, posts: data.content, total: data.totalElements };
|
||||
return { kind, board, posts: data.content, total: data.totalElements };
|
||||
}
|
||||
|
||||
export const fetchBoards = async (token: string): Promise<Board[]> =>
|
||||
(await call("/api/scraped-posts/boards", token)).json();
|
||||
|
||||
export const markViewed = (token: string, id: number) =>
|
||||
call(`/api/scraped-posts/${id}/view`, token, { method: "POST" });
|
||||
Reference in new issue
Block a user