Skip to content

Commit

Permalink
Merge branch 'develop' into feature/#397
Browse files Browse the repository at this point in the history
  • Loading branch information
ashleysyheo authored Aug 11, 2023
2 parents b5be26f + 635ebdb commit 1c1c6ef
Show file tree
Hide file tree
Showing 225 changed files with 946 additions and 459 deletions.
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2023 hang-log

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
19 changes: 16 additions & 3 deletions frontend/.prettierrc
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,25 @@
"printWidth": 100,
"semi": true,
"importOrder": [
"^@utils/(.*)$",
"^@api/(.*)$",
"^@hooks/(.*)$",
"^react(.*)",
"^@tanstack/(.*)$",
"^recoil(.*)",
"^axios(.*)",
"^msw(.*)",
"^hang-log-design-system(.*)",
"^@pages/(.*)$",
"^@components/(.*)$",
"^@hooks/(.*)$",
"^@store/(.*)$",
"^@api/(.*)$",
"^@utils/(.*)$",
"^@router/(.*)$",
"^@type/(.*)$",
"^@constants/(.*)$",
"^@assets/(.*)$",
"^@styles/(.*)$",
"^@stories/(.*)$",
"^@mocks/(.*)$",
"^[./]"
],
"importOrderSeparation": true,
Expand Down
21 changes: 18 additions & 3 deletions frontend/.storybook/preview.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,18 @@
import type { Preview } from '@storybook/react';
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
import { HangLogProvider, Spinner } from 'hang-log-design-system';
import { initialize, mswDecorator } from 'msw-storybook-addon';

import React, { Suspense } from 'react';
import { MemoryRouter } from 'react-router-dom';

import { QueryClient, QueryClientProvider } from '@tanstack/react-query';

import { RecoilRoot } from 'recoil';

import { initialize, mswDecorator } from 'msw-storybook-addon';

import { HangLogProvider, Spinner } from 'hang-log-design-system';

import { axiosInstance } from '../src/api/axiosInstance';
import { ACCESS_TOKEN_KEY } from '../src/constants/api';
import { handlers } from '../src/mocks/handlers';

initialize();
Expand Down Expand Up @@ -43,6 +50,13 @@ export default preview;

const queryClient = new QueryClient();

const localStorageResetDecorator = (Story) => {
window.localStorage.clear();
window.localStorage.setItem(ACCESS_TOKEN_KEY, 'hanglogAccessToken');

return <Story />;
};

export const decorators = [
(Story) => (
<MemoryRouter initialEntries={['/']}>
Expand All @@ -57,5 +71,6 @@ export const decorators = [
</QueryClientProvider>
</MemoryRouter>
),
localStorageResetDecorator,
mswDecorator,
];
1 change: 1 addition & 0 deletions frontend/cypress/e2e/createTrip.cy.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { ACCESS_TOKEN_KEY } from '@constants/api';

import { accessToken } from '@mocks/data/member';

const TEST_URL = 'http://localhost:3000';
Expand Down
4 changes: 3 additions & 1 deletion frontend/cypress/e2e/login.cy.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import type { TripsData } from '@type/trips';

import { ACCESS_TOKEN_KEY } from '@constants/api';
import { PATH } from '@constants/path';

import { accessToken } from '@mocks/data/member';
import type { TripsData } from '@type/trips';

const TEST_URL = 'http://localhost:3000';

Expand Down
6 changes: 4 additions & 2 deletions frontend/cypress/e2e/trip.cy.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import { ACCESS_TOKEN_KEY } from '@constants/api';
import { accessToken } from '@mocks/data/member';
import type { CityData } from '@type/city';
import type { TripItemData } from '@type/tripItem';

import { ACCESS_TOKEN_KEY } from '@constants/api';

import { accessToken } from '@mocks/data/member';

const TEST_URL = 'http://localhost:3000';

describe('여행 수정 페이지', () => {
Expand Down
6 changes: 4 additions & 2 deletions frontend/cypress/e2e/trips.cy.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import { ACCESS_TOKEN_KEY } from '@constants/api';
import { accessToken } from '@mocks/data/member';
import type { CityData } from '@type/city';
import type { TripsData } from '@type/trips';

import { ACCESS_TOKEN_KEY } from '@constants/api';

import { accessToken } from '@mocks/data/member';

const TEST_URL = 'http://localhost:3000';

describe('여행 목록 페이지', () => {
Expand Down
2 changes: 1 addition & 1 deletion frontend/package-lock.json

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

20 changes: 19 additions & 1 deletion frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,24 @@
"name": "hang-log",
"version": "0.0.1",
"description": "장소 기반 여행 기록 서비스, \"행록\"",
"repository": "https://github.com/woowacourse-teams/2023-hang-log",
"contributors": [
{
"name": "Ashley Heo",
"email": "[email protected]",
"url": "https://github.com/ashleysyheo"
},
{
"name": "Woochan Lim",
"email": "[email protected]",
"url": "https://github.com/dladncks1217"
},
{
"name": "Dahye Yun",
"email": "[email protected]",
"url": "https://github.com/Dahyeeee"
}
],
"main": "index.js",
"scripts": {
"start": "cross-env NODE_ENV=development webpack --mode development",
Expand All @@ -15,7 +33,7 @@
},
"keywords": [],
"author": "",
"license": "ISC",
"license": "MIT",
"dependencies": {
"@emotion/react": "^11.11.1",
"@emotion/styled": "^11.11.0",
Expand Down
13 changes: 8 additions & 5 deletions frontend/src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
import { ACCESS_TOKEN_KEY } from '@constants/api';
import { isLoggedInState } from '@store/auth';
import { useLayoutEffect } from 'react';
import { Outlet } from 'react-router-dom';
import { useSetRecoilState } from 'recoil';

import { useMediaQuery } from '@hooks/common/useMediaQuery';
import { useResetError } from '@hooks/common/useResetError';
import { useSetRecoilState } from 'recoil';

import Error from '@components/common/Error/Error';
import ErrorBoundary from '@components/common/ErrorBoundary/ErrorBoundary';
Expand All @@ -14,6 +10,13 @@ import ToastContainer from '@components/common/ToastContainer/ToastContainer';
import Footer from '@components/layout/Footer/Footer';
import Header from '@components/layout/Header/Header';

import { useMediaQuery } from '@hooks/common/useMediaQuery';
import { useResetError } from '@hooks/common/useResetError';

import { isLoggedInState } from '@store/auth';

import { ACCESS_TOKEN_KEY } from '@constants/api';

const App = () => {
const { handleErrorReset } = useResetError();
useMediaQuery();
Expand Down
5 changes: 3 additions & 2 deletions frontend/src/api/axiosInstance.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import { BASE_URL, NETWORK } from '@constants/api';
import axios from 'axios';

import { checkAndSetToken, handleAPIError, handleTokenError } from '@api/interceptors';

import { AXIOS_BASE_URL, NETWORK } from '@constants/api';

export const axiosInstance = axios.create({
baseURL: BASE_URL,
baseURL: AXIOS_BASE_URL,
timeout: NETWORK.TIMEOUT,
withCredentials: true,
useAuth: true,
Expand Down
5 changes: 3 additions & 2 deletions frontend/src/api/city/getCity.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { END_POINTS } from '@constants/api';
import { axiosInstance } from '@api/axiosInstance';

import type { CityData } from '@type/city';

import { axiosInstance } from '@api/axiosInstance';
import { END_POINTS } from '@constants/api';

export const getCity = async () => {
const { data } = await axiosInstance.get<CityData[]>(END_POINTS.CITY);
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/api/dayLog/patchDayLogItemOrder.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { END_POINTS } from '@constants/api';

import { axiosInstance } from '@api/axiosInstance';

import { END_POINTS } from '@constants/api';

export interface PatchDayLogItemOrderParams {
tripId: number;
dayLogId: number;
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/api/dayLog/patchDayLogTitle.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { END_POINTS } from '@constants/api';

import { axiosInstance } from '@api/axiosInstance';

import { END_POINTS } from '@constants/api';

export interface PatchDayLogTitleRequestBody {
title: string;
}
Expand Down
5 changes: 3 additions & 2 deletions frontend/src/api/expense/getExpense.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { END_POINTS } from '@constants/api';
import { axiosInstance } from '@api/axiosInstance';

import type { ExpenseData } from '@type/expense';

import { axiosInstance } from '@api/axiosInstance';
import { END_POINTS } from '@constants/api';

export const getExpense = async (tripId: number) => {
const { data } = await axiosInstance.get<ExpenseData>(END_POINTS.EXPENSE(tripId));
Expand Down
5 changes: 3 additions & 2 deletions frontend/src/api/expense/getExpenseCategory.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { END_POINTS } from '@constants/api';
import { axiosInstance } from '@api/axiosInstance';

import type { ExpenseCategoryData } from '@type/expense';

import { axiosInstance } from '@api/axiosInstance';
import { END_POINTS } from '@constants/api';

export const getExpenseCategory = async () => {
const { data } = await axiosInstance.get<ExpenseCategoryData[]>(END_POINTS.EXPENSE_CATEGORY);
Expand Down
5 changes: 3 additions & 2 deletions frontend/src/api/image/postImage.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { END_POINTS } from '@constants/api';
import { axiosInstance } from '@api/axiosInstance';

import type { ImageData } from '@type/image';

import { axiosInstance } from '@api/axiosInstance';
import { END_POINTS } from '@constants/api';

interface PostImageRequestBody {
images: FormData;
Expand Down
5 changes: 3 additions & 2 deletions frontend/src/api/interceptors.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import { ACCESS_TOKEN_KEY, ERROR_CODE, HTTP_STATUS_CODE } from '@constants/api';
import { PATH } from '@constants/path';
import type { AxiosError, InternalAxiosRequestConfig } from 'axios';

import { HTTPError } from '@api/HTTPError';
import { axiosInstance } from '@api/axiosInstance';
import { postNewToken } from '@api/member/postNewToken';

import { ACCESS_TOKEN_KEY, ERROR_CODE, HTTP_STATUS_CODE } from '@constants/api';
import { PATH } from '@constants/path';

export interface ErrorResponseData {
statusCode?: number;
message?: string;
Expand Down
5 changes: 3 additions & 2 deletions frontend/src/api/member/getUserInfo.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { END_POINTS } from '@constants/api';
import { axiosInstance } from '@api/axiosInstance';

import type { UserData } from '@type/member';

import { axiosInstance } from '@api/axiosInstance';
import { END_POINTS } from '@constants/api';

export const getUserInfo = async () => {
const { data } = await axiosInstance.get<UserData>(END_POINTS.MY_PAGE);
Expand Down
6 changes: 4 additions & 2 deletions frontend/src/api/member/postLogIn.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import { END_POINTS } from '@constants/api';
import type { TokenData } from '@type/member';
import type { AxiosResponse } from 'axios';

import { axiosInstance } from '@api/axiosInstance';

import type { TokenData } from '@type/member';

import { END_POINTS } from '@constants/api';

interface PostLogInRequestBody {
code: string;
}
Expand Down
5 changes: 3 additions & 2 deletions frontend/src/api/member/postLogOut.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { END_POINTS } from '@constants/api';
import { axiosInstance } from '@api/axiosInstance';

import type { TokenData } from '@type/member';

import { axiosInstance } from '@api/axiosInstance';
import { END_POINTS } from '@constants/api';

export const postLogout = (data: TokenData) => {
return axiosInstance.post(END_POINTS.LOGOUT, data);
Expand Down
5 changes: 3 additions & 2 deletions frontend/src/api/member/postNewToken.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { END_POINTS } from '@constants/api';
import { axiosInstance } from '@api/axiosInstance';

import type { TokenData } from '@type/member';

import { axiosInstance } from '@api/axiosInstance';
import { END_POINTS } from '@constants/api';

export const postNewToken = async () => {
const { data } = await axiosInstance.post<TokenData>(END_POINTS.TOKEN);
Expand Down
5 changes: 3 additions & 2 deletions frontend/src/api/member/putUserInfo.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { END_POINTS } from '@constants/api';
import { axiosInstance } from '@api/axiosInstance';

import type { UserData } from '@type/member';

import { axiosInstance } from '@api/axiosInstance';
import { END_POINTS } from '@constants/api';

export const putUserInfo = (data: UserData) => {
return axiosInstance.put<UserData>(END_POINTS.MY_PAGE, { ...data });
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/api/trip/deleteTrip.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { END_POINTS } from '@constants/api';

import { axiosInstance } from '@api/axiosInstance';

import { END_POINTS } from '@constants/api';

interface DeleteTripParams {
tripId: number;
}
Expand Down
5 changes: 3 additions & 2 deletions frontend/src/api/trip/getTrip.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { END_POINTS } from '@constants/api';
import { axiosInstance } from '@api/axiosInstance';

import type { TripData } from '@type/trip';

import { axiosInstance } from '@api/axiosInstance';
import { END_POINTS } from '@constants/api';

export const getTrip = async (tripId: number) => {
const { data } = await axiosInstance.get<TripData>(END_POINTS.TRIP(tripId));
Expand Down
5 changes: 3 additions & 2 deletions frontend/src/api/trip/postTrip.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { END_POINTS } from '@constants/api';
import { axiosInstance } from '@api/axiosInstance';

import type { NewTripData } from '@type/trips';

import { axiosInstance } from '@api/axiosInstance';
import { END_POINTS } from '@constants/api';

export const postTrip = async (newTripData: NewTripData) => {
const response = await axiosInstance.post(END_POINTS.TRIPS, newTripData);
Expand Down
Loading

0 comments on commit 1c1c6ef

Please sign in to comment.