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

FE-54πŸ”€ epic브랜치 μ΅œμ‹ ν™” #90

Merged
merged 14 commits into from
Jul 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
14 commits
Select commit Hold shift + click to select a range
2c6445a
FE-61 πŸ”¨ eslint κ·œμΉ™ μˆ˜μ •
newjinlee Jul 15, 2024
2ddc398
FE-61 πŸ”₯ InteractiveEmotionIconCard μ‚­μ œ
newjinlee Jul 15, 2024
3a0e0a0
FE-61 πŸ”¨ EpigramCard μ‚¬μ΄μ¦ˆ μž¬μ •μ˜
newjinlee Jul 15, 2024
6dd4a48
FE-61 πŸ“ 곡용 μ»΄ν¬λ„ŒνŠΈ ν…ŒμŠ€νŠΈ ν…μŠ€νŠΈ 주석 μΆ”κ°€
newjinlee Jul 15, 2024
78d6bd0
FE-61 πŸ”¨ CommentCard νƒ€μž… λ‚΄λΆ€ μ •μ˜
newjinlee Jul 15, 2024
2430b6a
FE-61 :truck: 감정 μΉ΄λ“œ 폴더 ꡬ쑰 λ³€κ²½
newjinlee Jul 15, 2024
3732b6f
FE-61 πŸ“ 감정 μΉ΄λ“œ, 감정 μ…€λ ‰ν„° 주석 μΆ”κ°€
newjinlee Jul 15, 2024
a2ba4b3
FE-61 :fire: λŒ“κΈ€ μΉ΄λ“œ λ””ν΄νŠΈ ν”„λ‘­ μ‚­μ œ
newjinlee Jul 15, 2024
e37fa06
Merge pull request #24 from epigram5-9/fix/FE-61--common-components
newjinlee Jul 15, 2024
8dd99fa
FE-62 ✨fix: 주석 μˆ˜μ • 및 νƒ€μž… μˆ˜μ • (#27)
imsoohyeok Jul 15, 2024
cdf96d7
Merge pull request #32 from epigram5-9/epic/FE-46-common-components
newjinlee Jul 20, 2024
596369a
FE-29 :twisted_rightwards_arrows: 둜그인 νŽ˜μ΄μ§€ 머지 μš”μ²­ (#39)
jangmoonwon Jul 25, 2024
4ba94c8
FE-71 πŸ”€ μ—ν”Όκ·Έλž¨ μž‘μ„± νŽ˜μ΄μ§€ (#71)
jisurk Jul 27, 2024
8e0a583
Merge branch 'main' of https://github.com/epigram5-9/epigram into mer…
Jul 28, 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
2 changes: 2 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ module.exports = {
'react/jsx-props-no-spreading': 'off',
'no-use-before-define': 'off',
'@typescript-eslint/no-use-before-define': ['off'],
"react/require-default-props": 'off',
"react/self-closing-comp": 'off',
},
settings: {
react: {
Expand Down
5 changes: 5 additions & 0 deletions public/lg.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
15 changes: 15 additions & 0 deletions public/logo-google.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 13 additions & 0 deletions public/logo-kakao.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions public/logo-naver.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 9 additions & 0 deletions src/apis/add.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { AddEpigramRequestType, AddEpigramResponseType } from '@/schema/addEpigram';
import httpClient from '.';

const postEpigram = async (request: AddEpigramRequestType): Promise<AddEpigramResponseType> => {
const response = await httpClient.post<AddEpigramResponseType>('/epigrams', request);
return response.data;
};

export default postEpigram;
9 changes: 9 additions & 0 deletions src/apis/auth.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import type { PostSigninRequestType, PostSigninResponseType } from '@/schema/auth';
import httpClient from '.';

const postSignin = async (request: PostSigninRequestType): Promise<PostSigninResponseType> => {
const response = await httpClient.post('/auth/signIn', request);
return response.data;
};

export default postSignin;
56 changes: 37 additions & 19 deletions src/apis/index.ts
Original file line number Diff line number Diff line change
@@ -1,34 +1,52 @@
import axios from 'axios';
import qs from 'qs';

// NOTE: 토큰 κ°€μ Έμ˜€λŠ” ν•¨μˆ˜
const getToken = () =>
'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6MjIsInRlYW1JZCI6IjUtOSIsInNjb3BlIjoiYWNjZXNzIiwiaWF0IjoxNzIyMDUwNTY3LCJleHAiOjE3MjIwNTIzNjcsImlzcyI6InNwLWVwaWdyYW0ifQ.uD0OZu7OFxBl3XqHGqNaqCLCDcE9BZant875W9tVr0o';

// NOTE: axios μ„ μ–Έ
const httpClient = axios.create({
baseURL: process.env.NEXT_PUBLIC_BASE_URL,
paramsSerializer: (parameters) => qs.stringify(parameters, { arrayFormat: 'repeat', encode: false }),
});

// NOTE: μš”μ²­ 인터셉터 μΆ”κ°€
httpClient.interceptors.request.use(
(config) => {
const newConfig = { ...config };
const token = getToken();
if (token) {
newConfig.headers.Authorization = `Bearer ${token}`;
}
// NOTE: eslint-disable no-param-reassign λ―Έν•΄κ²°λ‘œ μΈν•œ μ„€μ •
httpClient.interceptors.request.use((config) => {
const accessToken = localStorage.getItem('accessToken');
/* eslint-disable no-param-reassign */
if (accessToken) config.headers.Authorization = `Bearer ${accessToken}`;
/* eslint-enable no-param-reassign */
return config;
});

if (newConfig.data instanceof FormData) {
newConfig.headers['Content-Type'] = 'multipart/form-data';
} else {
newConfig.headers['Content-Type'] = 'application/json';
}
httpClient.interceptors.response.use(
(response) => response,

return newConfig;
(error) => {
if (error.response && error.response.status === 401) {
const refreshToken = localStorage.getItem('refreshToken');

if (!refreshToken) {
window.location.href = '/auth/SignIn';
return Promise.reject(error);
}

return httpClient
.post('/auth/refresh-token', null, {
headers: { Authorization: `Bearer ${refreshToken}` },
})
.then((response) => {
const { accessToken, refreshToken: newRefreshToken } = response.data;
localStorage.setItem('accessToken', accessToken);
localStorage.setItem('refreshToken', newRefreshToken);

const originalRequest = error.config;
return httpClient(originalRequest);
})
.catch(() => {
window.location.href = '/auth/SignIn';
return Promise.reject(error);
});
}
return Promise.reject(error);
},
(error) => Promise.reject(error),
);

export default httpClient;
16 changes: 13 additions & 3 deletions src/components/Card/CommentCard.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
import React from 'react';
import Image from 'next/image';
import { CommentCardProps } from '@/types/CommentCardTypes';
import { sizeStyles, textSizeStyles, gapStyles, paddingStyles, contentWidthStyles } from '@/styles/CommentCardStyles';

export interface CommentCardProps {
status: 'edit' | 'complete';
}

function CommentCard({ status }: CommentCardProps) {
return (
<div
Expand All @@ -17,8 +20,14 @@ function CommentCard({ status }: CommentCardProps) {
<div className={`flex-col justify-start items-start ${gapStyles.sm} ${gapStyles.md} ${gapStyles.lg} inline-flex ${contentWidthStyles.sm} ${contentWidthStyles.md} ${contentWidthStyles.lg}`}>
<div className='justify-between items-center w-full inline-flex'>
<div className='justify-start items-start gap-2 flex'>
<div className={`text-zinc-600 font-normal font-pretendard leading-normal ${textSizeStyles.sm.name} ${textSizeStyles.md.name} ${textSizeStyles.lg.name}`}>지킬과 ν•˜μ΄λ“œ</div>
<div className={`text-zinc-600 font-normal font-pretendard leading-normal ${textSizeStyles.sm.time} ${textSizeStyles.md.time} ${textSizeStyles.lg.time}`}>1μ‹œκ°„ μ „</div>
<div className={`text-zinc-600 font-normal font-pretendard leading-normal ${textSizeStyles.sm.name} ${textSizeStyles.md.name} ${textSizeStyles.lg.name}`}>
{/* ν…ŒμŠ€νŠΈ ν…μŠ€νŠΈμž…λ‹ˆλ‹€. */}
지킬과 ν•˜μ΄λ“œ
</div>
<div className={`text-zinc-600 font-normal font-pretendard leading-normal ${textSizeStyles.sm.time} ${textSizeStyles.md.time} ${textSizeStyles.lg.time}`}>
{/* ν…ŒμŠ€νŠΈ ν…μŠ€νŠΈμž…λ‹ˆλ‹€. */}
1μ‹œκ°„ μ „
</div>
</div>
{status === 'edit' && (
<div className='justify-start items-start gap-4 flex'>
Expand All @@ -30,6 +39,7 @@ function CommentCard({ status }: CommentCardProps) {
<div
className={`w-full text-zinc-800 font-normal font-pretendard ${textSizeStyles.sm.content} ${textSizeStyles.md.content} ${textSizeStyles.lg.content} ${contentWidthStyles.sm} ${contentWidthStyles.md} ${contentWidthStyles.lg}`}
>
{/* ν…ŒμŠ€νŠΈ ν…μŠ€νŠΈμž…λ‹ˆλ‹€. */}
였늘 ν•˜λ£¨ μš°μšΈν–ˆμ—ˆλŠ”λ° 덕뢄에 λ§Žμ€ 힘 μ–»κ³  κ°‘λ‹ˆλ‹€. μ—°κΈˆμˆ μ‚¬ μ±… λ‹€μ‹œ μ‚¬μ„œ μ˜€λžœλ§Œμ— μ½μ–΄λ΄μ•Όκ² μ–΄μš”!
</div>
</div>
Expand Down
Loading
Loading