Done
This commit is contained in:
parent
466d24e2b6
commit
848e0b8005
16
README.md
16
README.md
|
|
@ -1,11 +1,11 @@
|
||||||
# Structer Dashboard
|
# Hijabi Dashboard
|
||||||
|
|
||||||
|
## Installation
|
||||||
|
|
||||||
|
1. Clone the repository and navigate into the project directory:
|
||||||
|
|
||||||
1. Install the necessary dependencies using PNPM by running
|
|
||||||
```bash
|
```bash
|
||||||
|
git clone https://repos.point-dev.net/Karimaldeen/hijabi-dashboard.git
|
||||||
|
cd hijabi-dashboard
|
||||||
npm install
|
npm install
|
||||||
```
|
npm start
|
||||||
|
|
||||||
5. Launch the dashboard with
|
|
||||||
```bash
|
|
||||||
pnpm start
|
|
||||||
```
|
|
||||||
|
|
|
||||||
|
|
@ -5,16 +5,13 @@ import EditForm from './EditForm';
|
||||||
import { getInitialValues, getValidationSchema } from '../formUtil';
|
import { getInitialValues, getValidationSchema } from '../formUtil';
|
||||||
import { useParams } from 'react-router-dom';
|
import { useParams } from 'react-router-dom';
|
||||||
import KarimSpinner from '../../../Components/Karimalden/Ui/KarimSpinner';
|
import KarimSpinner from '../../../Components/Karimalden/Ui/KarimSpinner';
|
||||||
import { useGetOneCategories } from '../../../api/Categories';
|
import { useAddCategories, useGetOneCategories } from '../../../api/Categories';
|
||||||
import { useAddCategory } from '../../../api/category';
|
|
||||||
|
|
||||||
const EditPage = () => {
|
const EditPage = () => {
|
||||||
|
|
||||||
const { id } = useParams()
|
const { id } = useParams()
|
||||||
const { data,isLoading } = useGetOneCategories({
|
const { data,isLoading } = useGetOneCategories({id})
|
||||||
id
|
const {mutate} = useAddCategories()
|
||||||
})
|
|
||||||
const {mutate} = useAddCategory()
|
|
||||||
|
|
||||||
const handleSubmit = (values: any) => {
|
const handleSubmit = (values: any) => {
|
||||||
const newdata = {} as any;
|
const newdata = {} as any;
|
||||||
|
|
|
||||||
|
|
@ -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");
|
|
||||||
|
|
@ -7,8 +7,8 @@ function useGetOneQuery(key: string, url: string , params:any={},options:any={})
|
||||||
const {logout} = useAuthState()
|
const {logout} = useAuthState()
|
||||||
return useQuery(
|
return useQuery(
|
||||||
params ? [key, params] : key,
|
params ? [key, params] : key,
|
||||||
async ({id}:any) => {
|
async () => {
|
||||||
const response = await axios.get(url+"/"+id , {params});
|
const response = await axios.get(url+"/"+ params?.id);
|
||||||
return response.data.data;
|
return response.data.data;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user