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

Feat : 리스트 생성 페이지 구현 및 API 연결 #16

Merged
merged 7 commits into from
Feb 4, 2024
1 change: 1 addition & 0 deletions .env
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
NEXT_PUBLIC_BASE_URL = "https://dev.api.listywave.com"
2 changes: 1 addition & 1 deletion src/app/[userNickname]/collabolist/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
- [ ] 반응형 UI 구현
*/

import '@/styles/globalStyles.css';
import '@/styles/GlobalStyles.css';

import { USER_DATA_ME } from '../mockData/user'; // 삭제 예정

Expand Down
2 changes: 1 addition & 1 deletion src/app/[userNickname]/mylist/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
- [ ] 반응형 UI 구현
*/

import '@/styles/globalStyles.css';
import '@/styles/GlobalStyles.css';

import { USER_DATA_ME } from '../mockData/user'; // 삭제 예정

Expand Down
4 changes: 2 additions & 2 deletions src/app/_api/category/getCategories.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import axiosInstance from '@/lib/axios/axiosInstance';
import { CategoriesType } from '@/lib/types/categoriesType';
import { CategoryType } from '@/lib/types/categoriesType';

export const getCategories = async () => {
const response = await axiosInstance.get<CategoriesType>('/categories');
const response = await axiosInstance.get<CategoryType[]>('/categories');

return response.data;
};
9 changes: 8 additions & 1 deletion src/app/_api/list/createList.ts
Original file line number Diff line number Diff line change
@@ -1 +1,8 @@
// 리스트 생성 api
import axiosInstance from '@/lib/axios/axiosInstance';
import { ListCreateType } from '@/lib/types/listType';

export const createList = async (data: ListCreateType) => {
const response = await axiosInstance.post<ListCreateType>('/lists', data);

return response.data;
};
8 changes: 8 additions & 0 deletions src/app/_api/user/getUsers.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import axiosInstance from '@/lib/axios/axiosInstance';
import { UserProfilesType } from '@/lib/types/userProfileType';

export const getUsers = async () => {
const response = await axiosInstance.get<UserProfilesType>('/users');

return response.data;
};
9 changes: 4 additions & 5 deletions src/app/create/_components/CreateItem.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
import { useFormContext } from 'react-hook-form';

import BackIcon from '/public/icons/back.svg';
import Items from './Items';
import Items from './item/Items';
import * as styles from './CreateItem.css';

interface CreateItemProps {
onBackClick: () => void;
onSubmit: () => void;
}

export default function CreateItem({ onBackClick }: CreateItemProps) {
export default function CreateItem({ onBackClick, onSubmit }: CreateItemProps) {
const {
formState: { isValid },
} = useFormContext();
Expand All @@ -21,9 +22,7 @@ export default function CreateItem({ onBackClick }: CreateItemProps) {
</button>
<h1 className={styles.headerTitle}>리스트 생성</h1>
<button
onClick={() => {
console.log('제출');
}}
onClick={onSubmit}
className={isValid ? styles.headerNextButton : styles.headerNextButtonDisabled}
disabled={!isValid ? true : false}
>
Expand Down
Loading