notification count
This commit is contained in:
@@ -19,3 +19,10 @@ export const useGetCategories = () => {
|
||||
enabled: !!name,
|
||||
});
|
||||
};
|
||||
|
||||
export const useGetNotificationsCount = () => {
|
||||
return useQuery({
|
||||
queryKey: ["notifications-count"],
|
||||
queryFn: api.getNotificationsCount,
|
||||
});
|
||||
};
|
||||
|
||||
@@ -1,5 +1,9 @@
|
||||
import { api } from "@/config/axios";
|
||||
import { CategoriesResponse, FoodsResponse } from "../types/Types";
|
||||
import {
|
||||
CategoriesResponse,
|
||||
FoodsResponse,
|
||||
NotificationsCountResponse,
|
||||
} from "../types/Types";
|
||||
|
||||
export const getFoods = async (slug: string): Promise<FoodsResponse> => {
|
||||
const response = await api.get<FoodsResponse>(
|
||||
@@ -16,3 +20,12 @@ export const getCategories = async (
|
||||
);
|
||||
return response.data;
|
||||
};
|
||||
|
||||
export const getNotificationsCount = async (): Promise<
|
||||
NotificationsCountResponse
|
||||
> => {
|
||||
const response = await api.get<NotificationsCountResponse>(
|
||||
`/public/notifications/unseen-count`
|
||||
);
|
||||
return response.data;
|
||||
};
|
||||
|
||||
@@ -76,3 +76,9 @@ export interface Food {
|
||||
|
||||
export type FoodsResponse = BaseResponse<Food[]>;
|
||||
export type FoodResponse = BaseResponse<Food>;
|
||||
|
||||
export interface NotificationsCountData {
|
||||
count: number;
|
||||
}
|
||||
|
||||
export type NotificationsCountResponse = BaseResponse<NotificationsCountData>;
|
||||
|
||||
Reference in New Issue
Block a user