all types move to file types
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
import { useMutation, useQuery } from "@tanstack/react-query";
|
import { useMutation, useQuery } from "@tanstack/react-query";
|
||||||
import * as api from "../service/FoodService";
|
import * as api from "../service/FoodService";
|
||||||
import type { GetFoodsParams } from "../service/FoodService";
|
import type { GetFoodsParams } from "../types/Types";
|
||||||
|
|
||||||
export const useCreateFood = () => {
|
export const useCreateFood = () => {
|
||||||
return useMutation({
|
return useMutation({
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { useState, useMemo } from 'react'
|
import { useState, useMemo } from 'react'
|
||||||
import type { FilterValues } from '@/components/Filters'
|
import type { FilterValues } from '@/components/Filters'
|
||||||
import type { GetFoodsParams } from '../service/FoodService'
|
import type { GetFoodsParams } from '../types/Types'
|
||||||
|
|
||||||
const DEFAULT_PAGE = 1
|
const DEFAULT_PAGE = 1
|
||||||
const DEFAULT_LIMIT = 10
|
const DEFAULT_LIMIT = 10
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ import axios from "@/config/axios";
|
|||||||
import type {
|
import type {
|
||||||
CreateFoodType,
|
CreateFoodType,
|
||||||
GetCategoriesResponseType,
|
GetCategoriesResponseType,
|
||||||
|
GetFoodsParams,
|
||||||
GetFoodsResponseType,
|
GetFoodsResponseType,
|
||||||
} from "../types/Types";
|
} from "../types/Types";
|
||||||
|
|
||||||
@@ -10,16 +11,6 @@ export const createFood = async (params: CreateFoodType) => {
|
|||||||
return data;
|
return data;
|
||||||
};
|
};
|
||||||
|
|
||||||
export type GetFoodsParams = {
|
|
||||||
page?: number;
|
|
||||||
limit?: number;
|
|
||||||
search?: string;
|
|
||||||
orderBy?: string;
|
|
||||||
order?: "asc" | "desc";
|
|
||||||
categoryId?: string;
|
|
||||||
isActive?: boolean;
|
|
||||||
};
|
|
||||||
|
|
||||||
export const getFoods = async (
|
export const getFoods = async (
|
||||||
params?: GetFoodsParams
|
params?: GetFoodsParams
|
||||||
): Promise<GetFoodsResponseType> => {
|
): Promise<GetFoodsResponseType> => {
|
||||||
|
|||||||
@@ -67,5 +67,15 @@ export type Food = {
|
|||||||
categories: Category[];
|
categories: Category[];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export type GetFoodsParams = {
|
||||||
|
page?: number;
|
||||||
|
limit?: number;
|
||||||
|
search?: string;
|
||||||
|
orderBy?: string;
|
||||||
|
order?: "asc" | "desc";
|
||||||
|
categoryId?: string;
|
||||||
|
isActive?: boolean;
|
||||||
|
};
|
||||||
|
|
||||||
export type GetCategoriesResponseType = IResponse<Category[]>;
|
export type GetCategoriesResponseType = IResponse<Category[]>;
|
||||||
export type GetFoodsResponseType = IResponse<Food[]>;
|
export type GetFoodsResponseType = IResponse<Food[]>;
|
||||||
|
|||||||
Reference in New Issue
Block a user