useNotification init

This commit is contained in:
2023-08-14 13:44:43 +03:30
parent c60a85ca03
commit 674613e765
5 changed files with 47 additions and 13 deletions

View File

@@ -0,0 +1,26 @@
import useSWR from 'swr'
import {GET_SIDEBAR_NOTIFICATION} from "@/core/data/apiRoutes";
import useRequest from "@/lib/app/hooks/useRequest";
const useNotification = () => {
const requestServer = useRequest({auth: true})
//swr config
const fetcher = (...args) => {
return requestServer(args, 'get', {
pending: false,
success: {notification: {show: false}}
}).then((response) => {
return response.data.data;
}).catch(() => {
})
};
const {data} = useSWR(GET_SIDEBAR_NOTIFICATION, fetcher)
const notification_count = data
//swr config
// render data
return {notification_count}
}
export default useNotification