all types move to file types

This commit is contained in:
hamid zarghami
2025-11-15 12:45:18 +03:30
parent f83a66f696
commit 0fd87e99f2
4 changed files with 13 additions and 12 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
import { useMutation, useQuery } from "@tanstack/react-query";
import * as api from "../service/FoodService";
import type { GetFoodsParams } from "../service/FoodService";
import type { GetFoodsParams } from "../types/Types";
export const useCreateFood = () => {
return useMutation({
+1 -1
View File
@@ -1,6 +1,6 @@
import { useState, useMemo } from 'react'
import type { FilterValues } from '@/components/Filters'
import type { GetFoodsParams } from '../service/FoodService'
import type { GetFoodsParams } from '../types/Types'
const DEFAULT_PAGE = 1
const DEFAULT_LIMIT = 10
+1 -10
View File
@@ -2,6 +2,7 @@ import axios from "@/config/axios";
import type {
CreateFoodType,
GetCategoriesResponseType,
GetFoodsParams,
GetFoodsResponseType,
} from "../types/Types";
@@ -10,16 +11,6 @@ export const createFood = async (params: CreateFoodType) => {
return data;
};
export type GetFoodsParams = {
page?: number;
limit?: number;
search?: string;
orderBy?: string;
order?: "asc" | "desc";
categoryId?: string;
isActive?: boolean;
};
export const getFoods = async (
params?: GetFoodsParams
): Promise<GetFoodsResponseType> => {
+10
View File
@@ -67,5 +67,15 @@ export type Food = {
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 GetFoodsResponseType = IResponse<Food[]>;