From 91818766ed6cc12e4793fbd23217ecb276855411 Mon Sep 17 00:00:00 2001 From: earthyoung Date: Wed, 20 Nov 2024 16:11:03 +0900 Subject: [PATCH 1/5] =?UTF-8?q?style:=20=EC=B9=B4=ED=85=8C=EA=B3=A0?= =?UTF-8?q?=EB=A6=AC=20=EC=88=98=EC=A0=95=20=EB=AA=A8=EB=8B=AC=20=EA=B5=AC?= =?UTF-8?q?=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/_layout.jsx | 172 +++++++++--------- app/categoryView/categoryListView.jsx | 2 + components/categoryView/Category.tsx | 44 ----- .../categoryView/CategoryBottomSheet.tsx | 117 ++++++++++++ ...egoryListItem.jsx => CategoryListItem.tsx} | 40 ++-- contexts/CategoryBottomSheetProvider.js | 34 ++++ locales/en.json | 12 +- locales/ko.json | 12 +- 8 files changed, 291 insertions(+), 142 deletions(-) delete mode 100644 components/categoryView/Category.tsx create mode 100644 components/categoryView/CategoryBottomSheet.tsx rename components/categoryView/{CategoryListItem.jsx => CategoryListItem.tsx} (55%) create mode 100644 contexts/CategoryBottomSheetProvider.js diff --git a/app/_layout.jsx b/app/_layout.jsx index 25f339e..1aeb44a 100755 --- a/app/_layout.jsx +++ b/app/_layout.jsx @@ -3,6 +3,8 @@ import CategoryAddIcon from '@/components/CategoryAddIcon'; import HeaderIcon from '@/components/HeaderIcon'; import HeaderMenu from '@/components/HeaderMenu'; import { env, getSentryConfig, getStoryBookConfig } from '@/constants/env'; +import CategoryBottomSheetProvider from '@/contexts/CategoryBottomSheetProvider'; +import FunnelProvider from '@/contexts/FunnelContext'; import LoginProvider from '@/contexts/LoginContext'; import '@/locales/index'; import { default as theme } from '@/theme/theme.json'; @@ -16,7 +18,6 @@ import React from 'react'; import { useTranslation } from 'react-i18next'; import { GestureHandlerRootView } from 'react-native-gesture-handler'; import { default as mapping } from '../theme/mapping.json'; -import FunnelProvider from '@/contexts/FunnelContext'; const SENTRY_MODE = env.SENTRY_MODE; Sentry.init({ @@ -48,88 +49,93 @@ const RootLayout = () => { <> - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + diff --git a/app/categoryView/categoryListView.jsx b/app/categoryView/categoryListView.jsx index f850c33..77ca997 100644 --- a/app/categoryView/categoryListView.jsx +++ b/app/categoryView/categoryListView.jsx @@ -1,3 +1,4 @@ +import CategoryBottomSheet from '@/components/categoryView/CategoryBottomSheet'; import CategoryListItem from '@/components/categoryView/CategoryListItem'; import { LoginContext } from '@/contexts/LoginContext'; import useCategoriesQuery from '@/hooks/api/useCategoriesQuery'; @@ -33,6 +34,7 @@ const CategoryListView = () => { data={orderedCategories} renderItem={({ item }) => renderItem({ item })} /> + diff --git a/components/categoryView/Category.tsx b/components/categoryView/Category.tsx deleted file mode 100644 index a66dad6..0000000 --- a/components/categoryView/Category.tsx +++ /dev/null @@ -1,44 +0,0 @@ -// import colors from '@/theme/theme.json'; -// import { heightPercentage, widthPercentage } from '@/utils/responsiveSize'; -// import { Icon } from '@ui-kitten/components'; -// import React from 'react'; -// import { Pressable, StyleSheet, View } from 'react-native'; -// import DailyTodos from '../todayView/dailyTodos/DailyTodos'; -// import CategoryButton from './CategoryButton'; - -// interface CategoryProps { -// categoryId: number; -// categoryName: string; -// } - -// const Category: React.FC = ({ categoryId, categoryName }) => { -// return ( -// -// -// -// -// -// -// -// -// -// ); -// }; - -// const styles = StyleSheet.create({ -// headerContainer: { -// flexDirection: 'row', -// justifyContent: 'space-between', -// }, -// icon: { -// width: widthPercentage(16), -// height: heightPercentage(16), -// }, -// plusIconContainer: { -// backgroundColor: colors.Gray02, -// padding: widthPercentage(8), -// borderRadius: widthPercentage(4), -// }, -// }); - -// export default Category; diff --git a/components/categoryView/CategoryBottomSheet.tsx b/components/categoryView/CategoryBottomSheet.tsx new file mode 100644 index 0000000..4d13c30 --- /dev/null +++ b/components/categoryView/CategoryBottomSheet.tsx @@ -0,0 +1,117 @@ +import { CategoryBottomSheetContext } from '@/contexts/CategoryBottomSheetProvider'; +import fontStyles from '@/theme/fontStyles'; +import colors from '@/theme/theme.json'; +import { heightPercentage, widthPercentage } from '@/utils/responsiveSize'; +import BottomSheet, { BottomSheetView } from '@gorhom/bottom-sheet'; +import { Icon } from '@ui-kitten/components'; +import React, { useContext } from 'react'; +import { useTranslation } from 'react-i18next'; +import { Pressable, StyleSheet, Text, TextInput, View } from 'react-native'; + +enum CategoryModes { + ADD = 1, + EDIT = 2, +} + +const CategoryBottomSheet = () => { + const { mode, editingItem } = useContext(CategoryBottomSheetContext); + const { t } = useTranslation(); + const categoryAddText = t('components.categoryModal.addCategory'); + const categoryEditText = t('components.categoryModal.editCategory'); + const titleText = + mode === CategoryModes.ADD ? categoryAddText : categoryEditText; + const { bottomSheetRef } = useContext(CategoryBottomSheetContext); + + return ( + + + + {titleText} + + + + + + + + {t('components.categoryModal.categoryName')} + + + + + + + {t('components.categoryModal.confirm')} + + + + + + + ); +}; + +const styles = StyleSheet.create({ + bottomSheetView: { + flex: 1, + padding: widthPercentage(18), + backgroundColor: 'white', + }, + topContainer: { + backgroundColor: 'white', + flexDirection: 'row', + justifyContent: 'space-between', + marginTop: heightPercentage(20), + height: heightPercentage(60), + }, + middleContainer: { + justifyContent: 'space-between', + flex: 1, + }, + bottomContainer: { + marginBottom: heightPercentage(20), + }, + icon: { + width: heightPercentage(20), + height: heightPercentage(20), + }, + titleText: { + fontSize: fontStyles.Subtitle.S1.B_130.fontSize, + fontFamily: fontStyles.Subtitle.S1.B_130.fontFamily, + }, + nameText: { + fontSize: fontStyles.Paragraph.P1.M_100.fontSize, + fontFamily: fontStyles.Paragraph.P1.M_100.fontFamily, + marginBottom: widthPercentage(12), + }, + textInput: { + borderWidth: 1, + borderColor: '#E6E8EB', + borderRadius: widthPercentage(12), + height: heightPercentage(42), + paddingHorizontal: widthPercentage(16), + }, + buttonText: { + color: 'white', + fontSize: fontStyles.Subtitle.S1.M_100.fontSize, + fontFamily: fontStyles.Subtitle.S1.M_100.fontFamily, + }, + button: { + paddingHorizontal: widthPercentage(8), + paddingVertical: widthPercentage(16), + justifyContent: 'center', + alignItems: 'center', + backgroundColor: colors.Blue01, + borderRadius: widthPercentage(12), + }, +}); + +export default CategoryBottomSheet; diff --git a/components/categoryView/CategoryListItem.jsx b/components/categoryView/CategoryListItem.tsx similarity index 55% rename from components/categoryView/CategoryListItem.jsx rename to components/categoryView/CategoryListItem.tsx index d013e41..4d281cb 100644 --- a/components/categoryView/CategoryListItem.jsx +++ b/components/categoryView/CategoryListItem.tsx @@ -1,22 +1,40 @@ -import { useRouter } from 'expo-router'; +import { + CategoryBottomSheetContext, + EDIT, +} from '@/contexts/CategoryBottomSheetProvider'; +import React, { useContext } from 'react'; import { Pressable, StyleSheet, View } from 'react-native'; import DragAndDropIcon from '../icons/DragAndDropIcon'; import CategoryButton from './CategoryButton'; -const CategoryListItem = ({ item, isDraggedOn = false }) => { - const router = useRouter(); +interface CategoryListItemProps { + // eslint-disable-next-line @typescript-eslint/no-explicit-any + item: any; + isDraggedOn: boolean; +} - const handlePress = categoryItem => { - router.push({ - pathname: 'categoryView/categoryEditView', - params: { - ...categoryItem, - }, - }); +const CategoryListItem: React.FC = ({ + item, + isDraggedOn = false, +}) => { + const { openBottomSheet, setMode, setEditingItem } = useContext( + CategoryBottomSheetContext, + ); + + const handlePress = () => { + // router.push({ + // pathname: 'categoryView/categoryEditView', + // params: { + // ...categoryItem, + // }, + // }); + setMode(EDIT); + setEditingItem(item); + openBottomSheet(); }; return ( - handlePress(item)}> + handlePress()}> { + const bottomSheetRef = useRef(null); + const [mode, setMode] = useState(ADD); + const [editingItem, setEditingItem] = useState(null); + + const openBottomSheet = () => { + if (bottomSheetRef.current) { + bottomSheetRef.current.snapToIndex(0); + } + }; + return ( + + {children} + + ); +}; + +export default CategoryBottomSheetProvider; diff --git a/locales/en.json b/locales/en.json index 26a7df5..7efb2b9 100644 --- a/locales/en.json +++ b/locales/en.json @@ -43,7 +43,8 @@ "label": "category input", "placeholder": "Write a category", "color": "Color", - "close": "Close" + "close": "Close", + "title": "Add Category" }, "categoryEditView": { "category": "category", @@ -51,7 +52,8 @@ "color": "color", "edit": "Edit", "delete": "Delete", - "close": "Close" + "close": "Close", + "title": "Edit Category" } }, "components": { @@ -93,6 +95,12 @@ "createSubTodoWithAi": "Generate sub-todo", "createSubTodo": "Add sub-todo", "putInbox": "Put Inbox" + }, + "categoryModal": { + "addCategory": "Add Category", + "editCategory": "Edit Category", + "categoryName": "Category Name", + "confirm": "Confirm" } }, "common": { diff --git a/locales/ko.json b/locales/ko.json index 20c5d9e..53872e3 100644 --- a/locales/ko.json +++ b/locales/ko.json @@ -44,7 +44,8 @@ "label": "카테고리 입력", "placeholder": "카테고리를 입력해주세요", "color": "색상", - "close": "닫기" + "close": "닫기", + "title": "카테고리 생성" }, "categoryEditView": { "category": "카테고리", @@ -52,7 +53,8 @@ "color": "색상", "edit": "수정하기", "delete": "삭제하기", - "close": "닫기" + "close": "닫기", + "title": "카테고리 수정" } }, "components": { @@ -94,6 +96,12 @@ "createSubTodoWithAi": "하위 투두 AI로 만들기", "createSubTodo": "하위 투두 직접 만들기", "putInbox": "인박스에 넣기" + }, + "categoryModal": { + "addCategory": "카테고리 추가", + "editCategory": "카테고리 수정", + "categoryName": "카테고리 이름", + "confirm": "확인" } }, "common": { From 9c29eee2a4bea2230059c2ff5edf85ddc93ea7be Mon Sep 17 00:00:00 2001 From: earthyoung Date: Wed, 20 Nov 2024 16:23:59 +0900 Subject: [PATCH 2/5] =?UTF-8?q?style:=20=EC=B9=B4=ED=85=8C=EA=B3=A0?= =?UTF-8?q?=EB=A6=AC=20=EB=AA=A8=EB=8B=AC=20=EC=B6=94=EA=B0=80=20=EC=8B=9C?= =?UTF-8?q?=20=EB=94=94=EC=9E=90=EC=9D=B8=20=EB=B0=8F=20=EC=83=81=ED=83=9C?= =?UTF-8?q?=EA=B4=80=EB=A6=AC=20=EB=B0=98=EC=98=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/CategoryAddIcon.jsx | 19 +++++++++++++++---- .../categoryView/CategoryBottomSheet.tsx | 2 +- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/components/CategoryAddIcon.jsx b/components/CategoryAddIcon.jsx index 5bd3600..19b9771 100644 --- a/components/CategoryAddIcon.jsx +++ b/components/CategoryAddIcon.jsx @@ -1,14 +1,25 @@ -import { TouchableOpacity, StyleSheet } from 'react-native'; +import { + ADD, + CategoryBottomSheetContext, +} from '@/contexts/CategoryBottomSheetProvider'; import { Icon, useTheme } from '@ui-kitten/components'; -import React from 'react'; -import { router } from 'expo-router'; +import React, { useContext } from 'react'; +import { StyleSheet, TouchableOpacity } from 'react-native'; const CategoryAddIcon = () => { const theme = useTheme(); + const { setMode, setEditingItem, openBottomSheet } = useContext( + CategoryBottomSheetContext, + ); + const handlePress = () => { + setMode(ADD); + setEditingItem(null); + openBottomSheet(); + }; return ( router.push('categoryView/categoryAddView')} + onPress={() => handlePress()} style={styles.iconContainer} > { From 75ff1c9d52a58bdbc865c66c6925e478fc4b386c Mon Sep 17 00:00:00 2001 From: earthyoung Date: Wed, 20 Nov 2024 16:30:35 +0900 Subject: [PATCH 3/5] =?UTF-8?q?style:=20=EC=B9=B4=ED=85=8C=EA=B3=A0?= =?UTF-8?q?=EB=A6=AC=20=EB=AA=A8=EB=8B=AC=20=EC=97=B4=EB=A6=B4=20=EB=95=8C?= =?UTF-8?q?=20=EB=92=B7=EB=B0=B0=EA=B2=BD=EC=83=89=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../categoryView/CategoryBottomSheet.tsx | 20 +++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/components/categoryView/CategoryBottomSheet.tsx b/components/categoryView/CategoryBottomSheet.tsx index 2c5fbc5..9df4808 100644 --- a/components/categoryView/CategoryBottomSheet.tsx +++ b/components/categoryView/CategoryBottomSheet.tsx @@ -2,9 +2,12 @@ import { CategoryBottomSheetContext } from '@/contexts/CategoryBottomSheetProvid import fontStyles from '@/theme/fontStyles'; import colors from '@/theme/theme.json'; import { heightPercentage, widthPercentage } from '@/utils/responsiveSize'; -import BottomSheet, { BottomSheetView } from '@gorhom/bottom-sheet'; +import BottomSheet, { + BottomSheetBackdrop, + BottomSheetView, +} from '@gorhom/bottom-sheet'; import { Icon } from '@ui-kitten/components'; -import React, { useContext } from 'react'; +import React, { useCallback, useContext } from 'react'; import { useTranslation } from 'react-i18next'; import { Pressable, StyleSheet, Text, TextInput, View } from 'react-native'; @@ -22,12 +25,25 @@ const CategoryBottomSheet = () => { mode === CategoryModes.ADD ? categoryAddText : categoryEditText; const { bottomSheetRef } = useContext(CategoryBottomSheetContext); + const renderBackdrop = useCallback( + props => ( + + ), + [], + ); + return ( From 568c4e1953f562fa14f60d9d66a20205ef938ace Mon Sep 17 00:00:00 2001 From: earthyoung Date: Wed, 20 Nov 2024 16:35:49 +0900 Subject: [PATCH 4/5] =?UTF-8?q?fix:=20=EC=B9=B4=ED=85=8C=EA=B3=A0=EB=A6=AC?= =?UTF-8?q?=20=EB=AA=A8=EB=8B=AC=20X=20=EB=B2=84=ED=8A=BC=20=EB=88=8C?= =?UTF-8?q?=EB=A6=AC=EB=A9=B4=20=EB=8B=AB=ED=9E=88=EB=8F=84=EB=A1=9D=20?= =?UTF-8?q?=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/categoryView/CategoryBottomSheet.tsx | 6 ++++-- contexts/CategoryBottomSheetProvider.js | 8 ++++++++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/components/categoryView/CategoryBottomSheet.tsx b/components/categoryView/CategoryBottomSheet.tsx index 9df4808..3ecdf9f 100644 --- a/components/categoryView/CategoryBottomSheet.tsx +++ b/components/categoryView/CategoryBottomSheet.tsx @@ -17,7 +17,9 @@ enum CategoryModes { } const CategoryBottomSheet = () => { - const { mode, editingItem } = useContext(CategoryBottomSheetContext); + const { mode, editingItem, closeBottomSheet } = useContext( + CategoryBottomSheetContext, + ); const { t } = useTranslation(); const categoryAddText = t('components.categoryModal.addCategory'); const categoryEditText = t('components.categoryModal.editCategory'); @@ -48,7 +50,7 @@ const CategoryBottomSheet = () => { {titleText} - + diff --git a/contexts/CategoryBottomSheetProvider.js b/contexts/CategoryBottomSheetProvider.js index e714013..0c997fc 100644 --- a/contexts/CategoryBottomSheetProvider.js +++ b/contexts/CategoryBottomSheetProvider.js @@ -15,10 +15,18 @@ const CategoryBottomSheetProvider = ({ children }) => { bottomSheetRef.current.snapToIndex(0); } }; + + const closeBottomSheet = () => { + if (bottomSheetRef.current) { + bottomSheetRef.current.close(); + } + }; + return ( Date: Wed, 20 Nov 2024 17:17:07 +0900 Subject: [PATCH 5/5] =?UTF-8?q?fix:=20=EC=B9=B4=ED=85=8C=EA=B3=A0=EB=A6=AC?= =?UTF-8?q?=20=EC=88=98=EC=A0=95,=20=EC=83=9D=EC=84=B1=20=EC=98=A4?= =?UTF-8?q?=EB=A5=98=20=ED=99=95=EC=9D=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/categoryView/categoryEditView.jsx | 4 +- components/CategoryAddIcon.jsx | 8 ++-- .../categoryView/CategoryBottomSheet.tsx | 42 ++++++++++++++++--- components/categoryView/CategoryListItem.tsx | 8 ++-- contexts/CategoryBottomSheetProvider.js | 9 ++-- hooks/api/useCategoryMutation.js | 5 +-- 6 files changed, 55 insertions(+), 21 deletions(-) diff --git a/app/categoryView/categoryEditView.jsx b/app/categoryView/categoryEditView.jsx index 5bb2b26..62c6a79 100644 --- a/app/categoryView/categoryEditView.jsx +++ b/app/categoryView/categoryEditView.jsx @@ -63,10 +63,10 @@ const CategoryEditView = () => { const handleUpdateCategory = () => { const updatedData = { title: categoryName, - color: colors[selectedColor], + color: 1, category_id: params.id, }; - updateCategory({ updatedData }); + updateCategory(updatedData); }; const renderColorItem = ({ item }) => ( diff --git a/components/CategoryAddIcon.jsx b/components/CategoryAddIcon.jsx index 19b9771..fa34dac 100644 --- a/components/CategoryAddIcon.jsx +++ b/components/CategoryAddIcon.jsx @@ -8,12 +8,12 @@ import { StyleSheet, TouchableOpacity } from 'react-native'; const CategoryAddIcon = () => { const theme = useTheme(); - const { setMode, setEditingItem, openBottomSheet } = useContext( - CategoryBottomSheetContext, - ); + const { setMode, setCategoryId, openBottomSheet, setCategoryName } = + useContext(CategoryBottomSheetContext); const handlePress = () => { setMode(ADD); - setEditingItem(null); + setCategoryId(null); + setCategoryName(''); openBottomSheet(); }; diff --git a/components/categoryView/CategoryBottomSheet.tsx b/components/categoryView/CategoryBottomSheet.tsx index 3ecdf9f..4c4bf84 100644 --- a/components/categoryView/CategoryBottomSheet.tsx +++ b/components/categoryView/CategoryBottomSheet.tsx @@ -1,4 +1,8 @@ import { CategoryBottomSheetContext } from '@/contexts/CategoryBottomSheetProvider'; +import { + useCategoryAddMutation, + useCategoryUpdateMutation, +} from '@/hooks/api/useCategoryMutation'; import fontStyles from '@/theme/fontStyles'; import colors from '@/theme/theme.json'; import { heightPercentage, widthPercentage } from '@/utils/responsiveSize'; @@ -17,15 +21,42 @@ enum CategoryModes { } const CategoryBottomSheet = () => { - const { mode, editingItem, closeBottomSheet } = useContext( - CategoryBottomSheetContext, - ); + const { mode, categoryId, categoryName, setCategoryName, closeBottomSheet } = + useContext(CategoryBottomSheetContext); const { t } = useTranslation(); const categoryAddText = t('components.categoryModal.addCategory'); const categoryEditText = t('components.categoryModal.editCategory'); const titleText = mode === CategoryModes.ADD ? categoryAddText : categoryEditText; const { bottomSheetRef } = useContext(CategoryBottomSheetContext); + const { mutate: addCategory } = useCategoryAddMutation(); + const { mutate: updateCategory } = useCategoryUpdateMutation(); + + const handlePress = () => { + if (mode === CategoryModes.ADD) { + handleAddCategory(); + } else { + handleEditCategory(); + } + closeBottomSheet(); + }; + + const handleAddCategory = () => { + const addCategoryData = { + title: categoryName, + color: 1, + }; + addCategory({ addCategoryData }); + }; + + const handleEditCategory = () => { + const updatedData = { + title: categoryName, + color: 1, + category_id: categoryId, + }; + updateCategory(updatedData); + }; const renderBackdrop = useCallback( props => ( @@ -61,11 +92,12 @@ const CategoryBottomSheet = () => { - + {t('components.categoryModal.confirm')} diff --git a/components/categoryView/CategoryListItem.tsx b/components/categoryView/CategoryListItem.tsx index 4d281cb..2b1c41a 100644 --- a/components/categoryView/CategoryListItem.tsx +++ b/components/categoryView/CategoryListItem.tsx @@ -17,9 +17,8 @@ const CategoryListItem: React.FC = ({ item, isDraggedOn = false, }) => { - const { openBottomSheet, setMode, setEditingItem } = useContext( - CategoryBottomSheetContext, - ); + const { openBottomSheet, setMode, setCategoryId, setCategoryName } = + useContext(CategoryBottomSheetContext); const handlePress = () => { // router.push({ @@ -29,7 +28,8 @@ const CategoryListItem: React.FC = ({ // }, // }); setMode(EDIT); - setEditingItem(item); + setCategoryId(item.id); + setCategoryName(item.title); openBottomSheet(); }; diff --git a/contexts/CategoryBottomSheetProvider.js b/contexts/CategoryBottomSheetProvider.js index 0c997fc..91b1113 100644 --- a/contexts/CategoryBottomSheetProvider.js +++ b/contexts/CategoryBottomSheetProvider.js @@ -8,7 +8,8 @@ export const EDIT = 2; const CategoryBottomSheetProvider = ({ children }) => { const bottomSheetRef = useRef(null); const [mode, setMode] = useState(ADD); - const [editingItem, setEditingItem] = useState(null); + const [categoryName, setCategoryName] = useState(''); + const [categoryId, setCategoryId] = useState(null); const openBottomSheet = () => { if (bottomSheetRef.current) { @@ -30,8 +31,10 @@ const CategoryBottomSheetProvider = ({ children }) => { bottomSheetRef, mode, setMode, - editingItem, - setEditingItem, + categoryName, + setCategoryName, + categoryId, + setCategoryId, }} > {children} diff --git a/hooks/api/useCategoryMutation.js b/hooks/api/useCategoryMutation.js index 49e8ff3..c10cb43 100644 --- a/hooks/api/useCategoryMutation.js +++ b/hooks/api/useCategoryMutation.js @@ -18,9 +18,8 @@ export const useCategoryAddMutation = () => { }); }; -const updateCategoryFetcher = async ({ updatedData }) => { - const data = await Api.updateCategory({ updatedData }); - +const updateCategoryFetcher = async updatedData => { + const data = await Api.updateCategory(updatedData); return data; };