From 848e0b8005300ddfa1f80445ce61f96aebe4a053 Mon Sep 17 00:00:00 2001 From: KarimAldeen Date: Tue, 20 Feb 2024 14:58:24 +0300 Subject: [PATCH] Done --- README.md | 16 +++++++------- src/Pages/Categories/EditCategories/Page.tsx | 9 +++----- src/api/category.ts | 22 -------------------- src/api/helper/useGetOneQuery.ts | 4 ++-- 4 files changed, 13 insertions(+), 38 deletions(-) delete mode 100644 src/api/category.ts diff --git a/README.md b/README.md index 7e530f3..62b5dbd 100644 --- a/README.md +++ b/README.md @@ -1,11 +1,11 @@ -# Structer Dashboard +# Hijabi Dashboard -1. Install the necessary dependencies using PNPM by running -```bash -npm install -``` +## Installation + +1. Clone the repository and navigate into the project directory: -5. Launch the dashboard with ```bash - pnpm start - ``` +git clone https://repos.point-dev.net/Karimaldeen/hijabi-dashboard.git +cd hijabi-dashboard + npm install +npm start diff --git a/src/Pages/Categories/EditCategories/Page.tsx b/src/Pages/Categories/EditCategories/Page.tsx index 90c23d3..699290d 100644 --- a/src/Pages/Categories/EditCategories/Page.tsx +++ b/src/Pages/Categories/EditCategories/Page.tsx @@ -5,16 +5,13 @@ import EditForm from './EditForm'; import { getInitialValues, getValidationSchema } from '../formUtil'; import { useParams } from 'react-router-dom'; import KarimSpinner from '../../../Components/Karimalden/Ui/KarimSpinner'; -import { useGetOneCategories } from '../../../api/Categories'; -import { useAddCategory } from '../../../api/category'; +import { useAddCategories, useGetOneCategories } from '../../../api/Categories'; const EditPage = () => { const { id } = useParams() - const { data,isLoading } = useGetOneCategories({ - id - }) - const {mutate} = useAddCategory() + const { data,isLoading } = useGetOneCategories({id}) + const {mutate} = useAddCategories() const handleSubmit = (values: any) => { const newdata = {} as any; diff --git a/src/api/category.ts b/src/api/category.ts deleted file mode 100644 index d072659..0000000 --- a/src/api/category.ts +++ /dev/null @@ -1,22 +0,0 @@ - -import useAddMutation from "./helper/useAddMutation" -import useDeleteMutation from "./helper/useDeleteMutation" -import useGetQuery from "./helper/useGetQuery" -import { useToggleStatus } from "./helper/useToggleStatus"; -import useUpdateMutation from "./helper/useUpdateMutation" - - const API = { - GET: "/api/admin/categories", - ADD: "ategory", - UPDATE: "/api/admin/categories/update", - DELETE: "/api/admin/categories/delete", - UPDATE_STATUS: `/api/admin/categories/update_category_status`, - }; - - - const KEY = "CATEGORY"; - export const useGetCategory = (params?:any) => useGetQuery(KEY, API.GET, params); - export const useAddCategory = () => useAddMutation(KEY, API.ADD); - export const useUpdateCategory = () => useUpdateMutation(KEY, API.UPDATE); - export const useDeleteCategory = () =>useDeleteMutation(KEY, API.DELETE); - export const useUpdateCategoryStatus = () =>useToggleStatus(KEY, API.UPDATE_STATUS, "category_id"); \ No newline at end of file diff --git a/src/api/helper/useGetOneQuery.ts b/src/api/helper/useGetOneQuery.ts index e6d7293..0b2c335 100644 --- a/src/api/helper/useGetOneQuery.ts +++ b/src/api/helper/useGetOneQuery.ts @@ -7,8 +7,8 @@ function useGetOneQuery(key: string, url: string , params:any={},options:any={}) const {logout} = useAuthState() return useQuery( params ? [key, params] : key, - async ({id}:any) => { - const response = await axios.get(url+"/"+id , {params}); + async () => { + const response = await axios.get(url+"/"+ params?.id); return response.data.data; },