Skip to content

Commit

Permalink
๐Ÿ› ๏ธ FSD Architecture Public API ์ ์šฉ (#49)
Browse files Browse the repository at this point in the history
* feat: RootLayout public api ์ ์šฉ
* feat: IPhoneLayout public api ์ ์šฉ
* feat: FeedMainList public api ์ ์šฉ
* feat: FeedMainHeader public api ์ ์šฉ
* feat: ์ข‹์•„์š” API public api ์ ์šฉ
* feat: api log ํŒŒ์ผ public api ์ ์šฉ
* feat: axios config public api ์ ์šฉ
* feat: auth-store public api ์ ์šฉ
* feat: setup test public api ์ ์šฉ
* feat: Icon public api ์ ์šฉ
* feat: widget ๊ณ„์ธต ์ตœ์ƒ์œ„ index ์ œ๊ฑฐ
* feat: feature ๊ณ„์ธต ์ตœ์ƒ์œ„ index ์ œ๊ฑฐ
* feat: pages ๊ณ„์ธต ์ตœ์ƒ์œ„ index ์ œ๊ฑฐ

Closes #43
  • Loading branch information
BangDori authored May 11, 2024
1 parent f9bc08c commit 4c26a7d
Show file tree
Hide file tree
Showing 33 changed files with 55 additions and 46 deletions.
4 changes: 2 additions & 2 deletions src/app/layout/RootLayout.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Outlet } from 'react-router-dom';

export default function RootLayout() {
export const RootLayout = () => {
return <Outlet />;
}
};
2 changes: 1 addition & 1 deletion src/app/layout/iPhone/index.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export { IPhoneLayout } from './ui/IPhoneLayout';
export { IPhoneLayout } from './ui';
1 change: 1 addition & 0 deletions src/app/layout/iPhone/ui/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { IPhoneLayout } from './IPhoneLayout';
2 changes: 2 additions & 0 deletions src/app/layout/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export { IPhoneLayout } from './iPhone';
export { RootLayout } from './RootLayout';
5 changes: 2 additions & 3 deletions src/app/routers/index.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import { createBrowserRouter, RouteObject } from 'react-router-dom';

import { FeedMainPage } from '@/pages/index.ts';
import { FeedMainPage } from '@/pages/feed-main';

import { IPhoneLayout } from '../layout/iPhone/index.ts';
// import RootLayout from '../layout/RootLayout.tsx';
import { IPhoneLayout } from '../layout';

/**
* ๐Ÿšจ ํ˜„์žฌ iPhone Layout์€ DEV ๋ชจ๋“œ์—์„œ๋งŒ ํ™œ์„ฑํ™”๋˜๋Š” ๋ถ€๋ถ„์ด์ง€๋งŒ,
Expand Down
2 changes: 1 addition & 1 deletion src/features/feed-main-like/test/useLikes.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { renderHook, act, waitFor } from '@testing-library/react';
import { expect, test, vi } from 'vitest';

import * as likeModule from '@/shared/axios/like';
import { createQueryClientWrapper } from '@/shared/tests/setup';
import { createQueryClientWrapper } from '@/shared/tests';

import { useLikes } from '../api';

Expand Down
1 change: 0 additions & 1 deletion src/features/index.ts

This file was deleted.

3 changes: 2 additions & 1 deletion src/pages/feed-main/ui/FeedMainPage.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { FeedMainHeader, FeedMainList } from '@/widgets';
import { FeedMainHeader } from '@/widgets/feed-main-header';
import { FeedMainList } from '@/widgets/feed-main-list';
import './FeedMainPage.scss';

export const FeedMainPage = () => {
Expand Down
1 change: 0 additions & 1 deletion src/pages/index.ts

This file was deleted.

1 change: 1 addition & 0 deletions src/shared/axios/config/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { axiosInstance } from './instance';
2 changes: 1 addition & 1 deletion src/shared/axios/config/interceptors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {
logApiErrorOnDev,
logApiRequestOnDev,
logApiResponseOnDev,
} from '../dir/log';
} from '../dir';

export function onRequest(
config: InternalAxiosRequestConfig,
Expand Down
1 change: 1 addition & 0 deletions src/shared/axios/dir/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './log';
2 changes: 1 addition & 1 deletion src/shared/axios/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
export { axiosInstance } from './config/instance';
export { axiosInstance } from './config';
export * from './like';
24 changes: 1 addition & 23 deletions src/shared/axios/like/index.ts
Original file line number Diff line number Diff line change
@@ -1,23 +1 @@
import { axiosInstance } from '../config/instance';

/**
* ์ข‹์•„์š” API
* @param feedId ํ”ผ๋“œ ์•„์ด๋””
* @returns ์ข‹์•„์š” ์ƒํƒœ
*/
export async function requestLikeFeed(feedId: number) {
const { data } = await axiosInstance.put(`/feeds/${feedId}/likes`);

return data;
}

/**
* ์ข‹์•„์š” ์ทจ์†Œ API
* @param feedId ํ”ผ๋“œ ์•„์ด๋””
* @returns ์ข‹์•„์š” ์ƒํƒœ
*/
export async function requestUnlikeFeed(feedId: number) {
const { data } = await axiosInstance.delete(`/feeds/${feedId}/likes`);

return data;
}
export * from './like';
23 changes: 23 additions & 0 deletions src/shared/axios/like/like.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { axiosInstance } from '../config/instance';

/**
* ์ข‹์•„์š” API
* @param feedId ํ”ผ๋“œ ์•„์ด๋””
* @returns ์ข‹์•„์š” ์ƒํƒœ
*/
export async function requestLikeFeed(feedId: number) {
const { data } = await axiosInstance.put(`/feeds/${feedId}/likes`);

return data;
}

/**
* ์ข‹์•„์š” ์ทจ์†Œ API
* @param feedId ํ”ผ๋“œ ์•„์ด๋””
* @returns ์ข‹์•„์š” ์ƒํƒœ
*/
export async function requestUnlikeFeed(feedId: number) {
const { data } = await axiosInstance.delete(`/feeds/${feedId}/likes`);

return data;
}
1 change: 1 addition & 0 deletions src/shared/store/auth/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { setAccessToken, getAccessToken } from './auth-store';
2 changes: 1 addition & 1 deletion src/shared/store/index.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export { setAccessToken, getAccessToken } from './auth/auth-store';
export { setAccessToken, getAccessToken } from './auth';
1 change: 1 addition & 0 deletions src/shared/tests/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './setup';
1 change: 1 addition & 0 deletions src/shared/ui/icon/consts/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export type { IconName } from './sprite';
File renamed without changes.
2 changes: 1 addition & 1 deletion src/shared/ui/icon/index.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export { Icon } from './ui/Icon';
export { Icon } from './ui';
2 changes: 1 addition & 1 deletion src/shared/ui/icon/ui/Icon.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { IconName } from '../consts/sprite';
import { IconName } from '../consts';

interface IconProps {
name: IconName;
Expand Down
1 change: 1 addition & 0 deletions src/shared/ui/icon/ui/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { Icon } from './Icon';
2 changes: 1 addition & 1 deletion src/widgets/feed-main-header/index.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export { FeedMainHeader } from './ui/FeedMainHeader';
export { FeedMainHeader } from './ui';
1 change: 1 addition & 0 deletions src/widgets/feed-main-header/ui/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { FeedMainHeader } from './FeedMainHeader';
1 change: 1 addition & 0 deletions src/widgets/feed-main-list/api/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { useInfinityFeeds } from './useInfinityFeeds';
2 changes: 1 addition & 1 deletion src/widgets/feed-main-list/index.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export { FeedMainList } from './ui/FeedMainList';
export { FeedMainList } from './ui';
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { HttpResponse, http } from 'msw';
import { expect, test } from 'vitest';

import { server } from '@/setupTest';
import { render, screen } from '@/shared/tests/setup';
import { render, screen } from '@/shared/tests';

import { FeedMainList } from '..';

Expand Down
2 changes: 1 addition & 1 deletion src/widgets/feed-main-list/test/FeedMainList.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { HttpResponse, http } from 'msw';
import { vi, describe, expect, it } from 'vitest';

import { server } from '@/setupTest';
import { render, screen } from '@/shared/tests/setup';
import { render, screen } from '@/shared/tests';

import { FeedMainList } from '..';

Expand Down
2 changes: 1 addition & 1 deletion src/widgets/feed-main-list/ui/Feed.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { LikeButton } from '@/features';
import { LikeButton } from '@/features/feed-main-like';
import { Feed as FeedProps } from '@/shared/consts';
import { Icon, Profile } from '@/shared/ui';
import { calculateElapsedTime } from '@/shared/utils';
Expand Down
2 changes: 1 addition & 1 deletion src/widgets/feed-main-list/ui/FeedMainList.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { NetworkError, Observer } from '@/shared/ui';

import { useInfinityFeeds } from '../api/useInfinityFeeds';
import { useInfinityFeeds } from '../api';

import { Feed } from './Feed';
import { SkeletonFeedMainList } from './SkeletonFeedMainList';
Expand Down
1 change: 1 addition & 0 deletions src/widgets/feed-main-list/ui/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { FeedMainList } from './FeedMainList';
2 changes: 0 additions & 2 deletions src/widgets/index.ts

This file was deleted.

0 comments on commit 4c26a7d

Please sign in to comment.