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

๐Ÿ› ๏ธ FSD Architecture Public API ์ ์šฉ #49

Merged
merged 13 commits into from
May 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
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';
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.

Loading