This commit is contained in:
KarimAldeen 2024-02-20 14:58:24 +03:00
parent 466d24e2b6
commit 848e0b8005
4 changed files with 13 additions and 38 deletions

View File

@ -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

View File

@ -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;

View File

@ -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");

View File

@ -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;
},