Git Product home page Git Product logo

tilog-web-node-v2's Introduction

tilog-web-node-v2's People

Contributors

minje-98 avatar argon1025 avatar

Stargazers

 avatar

tilog-web-node-v2's Issues

전역상태가 필요없으므로 Redux를 사용하지 않습니다.

기능 수정

자세한 내용

비동기 관련 상태는 전부 React-Query를 사용하여 전역에서 관리해야할 상태가 거의 존재하지 않습니다.

Modal

Modal을 Context API로 구현합니다.

UserInfo

getinitprops를 통해 최초 유저 정보를 표시합니다.
유저데이터가 필요한 요청이 있을 경우 getMe를 통해 로직을 구성합니다.

Login Page를 생성하고, tilog open api 스팩에 맞게 구현

기능 추가

자세한 내용

프론트 로그인 플로우

프론트 로그인 플로우는 다음과 같습니다.

  1. fresh token이 존재하지 않을 경우 새로 로그인을 해야합니다.
  • header를 통한 login은 새페이지로 사용자에게 표시합니다.
  • header이외의 인가가 필요한 요청은 login 모달로 사용자에게 표시합니다.
  1. fresh token을 사용하여 Server Side에서 access token과 유저 정보를 받아 로그인된 html문서를 client에게 전달합니다.
  2. 2번을 페이지 마다 개별적으로 반복합니다.

위의 플로우 대로 이전 Login 관련 컴포넌트를 사용하여 tilog-open-api스팩에 맞게 구현합니다.
전체적인 로그인 로직은 여기를 참고하시면 됩니다.

Header User State

기능 추가

자세한 내용

로그인된 유저의 상태를 Header에서 표시합니다.

[Feature] Editor State

기능 추가

자세한 내용

  • 상태 연결
  • toast 적용
  • 임시저장 기능 적용
  • 비밀글, 일반글 기능 적용
  • react-form-hook 적용 / form error validation

디렉터리 수정

기타

자세한 내용

  • 하나의 컴포넌트를 구성하기위해 여러 폴더를 접근해야하는 문제점
  • 하나의 src 디렉터리에 모든 파일이 모여있는 문제점
  • 디렉터리 이름과 속해있는 폴더들이 관계가 없는 문제점

위와 같은 문제점을 해결합니다.

해당 이슈는 #43 에서 디렉터리 수정으로 분리되었습니다.

[리팩터링] Component

기타

리팩터링 목표

  1. File Structure 정의
  2. 강하게 결합중인 Component 분리
  3. Component를 작은 단위로 분리 후 Component 조립

유저 블로그 디자인

기능 추가

자세한 내용

  • 유저 이름, 한줄 소개
  • 유저가 작성한 포스트의 카테고리 리스트
  • 유저가 작성한 포스트 리스트
  • 깃허브 관련

헤더 컴포넌트 디자인

기능 추가

자세한 내용

헤더 컴포넌트 디자인

  • Navigation
  • Logo, PageTitle
  • Logined User || Github Login Button
  • Mobile Responsive
  • #34

폴더 구조 수정

기타 사항

자세한 내용

토론에 작성된 폴더 구조에 맞춰서 폴더 구조 수정합니다.

TailWind init

기능 추가

TailWind 모듈 설치
TailWind 프로젝트에 적용

silent refreshing accessToken

기타

자세한 내용

서버측에서 accessToken이 필요한 경우를 위해 서버측에서 accessToken발급 로직을 작성합니다.
추가적으로 axios interceptor로 accessToken을 재발급하는 로직은 클라이언트에서만 사용하도록 리팩터링합니다.

유저 상태 및 엑세스 토큰 스토어 변경

오류

자세한 내용

  • Context API에서 Redux, next-redux-wrapper, next-redux-cookie-wrapper를 사용하여 유저 상태를 관리하도록 변경
  • Access Token을 Axios header에 저장
  • tilog-open-api 스펙 변경으로 인한 수정

헤더 컴포넌트 상태 구현

기능 추가

자세한 내용

  • SSR를 통해 받은 유저 정보 판별하여 컴포넌트 구현
  • 페이지별 Routing을 위한 인터페이스 구현

코드리뷰 기록

오류

자세한 내용

  • 테크아이콘 constants로 이동및 병합
  • Styles 불필요한 파일 정리
  • _app.tsx 놀라움 주는 코드 정리
TILogApp.getInitialProps = async (context: AppContext) => {
  const { ctx } = context;
  if (!(ctx.req && ctx.res)) return { pageProps: {} };

  const session = await getIronSession(ctx.req, ctx.res, cookieConfig);
  return { pageProps: session };
};
  • export const AccessTokenContext = createContext<AccessTokenInterface|null>(null);
  • setAccessToken("");
  • else if 사용
} else {
        if (error.response?.status === 401) {
  • interface를 사용합시다
export async function getServerSideProps(context: {
  req: {
    cookies: {
      refreshToken: GetAccessTokenUsingRefreshTokenResponse;
    };
  };
}) {
  • 타입 정의, 보내고, 받는거 확실하게 할것 -> 작업할 때 다른 구현파일 참조 한다 싶으면 아 잘못했구나 생각하기

Erro Handling

기능 추가

자세한 내용

  • axios.interceptor로 글로벌 에러 헨들링

SSR시 Backend측의 rate-limiting을 고려해야합니다.

오류

자세한 내용

현재 Frontend에서 accessToken와 UserInfo 관련 데이터를 SSR을 통해 Backend에서 fetching하고 있습니다. SSR을 통해 Backend에게 데이터를 요청할때 요청한 Client측의 IP가 아닌 Server측의 IP로 fetching되고 있으며, 구조상 rate-limiting이 걸리기 쉬운 조건에 놓여 있습니다. (Backend측에서 API rate-limiting을 지정하여 DDOS 공격에 대응하고 있는 상황입니다.) 해결방안을 논의 해봅시다.

프로젝트 디렉터리 재배치

기타

자세한 내용

현재 프로젝트 디렉터리 위치가 초기 기획과 다른걸로 확인되어 디렉터리를 재배치하는 작업이 필요합니다.

로그인

기능 추가

자세한 내용

기존에 작성한 코드들을 리팩터링 합니다.

RefreshToken

  • RefreshToken 발급
  • RefreshToken 재발급
  • RefreshToken 파기

UserInfo

  • LocalStorage에 UserInfo 관리

AccessToken

  • AccessToken 발급
  • AccessToken 재발급

RefreshToken 관련 로직

image

image

AccessToken 관련 로직

image

image

브라우저

image

[Feature] Card Component State

기능 추가

자세한 내용

  • Post Card custom react-query & Component
  • Most Popular Post Card custom react-query & Component
  • 필요없는 파일들 제거

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.