LFFE-4 use notification add permission

This commit is contained in:
Yasiu1376
2023-10-30 15:32:39 +03:30
parent 1fa4441d92
commit 233c084f45
2 changed files with 9 additions and 2 deletions

View File

@@ -1,8 +1,12 @@
import useSWR from 'swr'
import {GET_SIDEBAR_NOTIFICATION} from "@/core/data/apiRoutes";
import useRequest from "@/lib/app/hooks/useRequest";
const GLOBAL_HAS_VALUE = process.env.NEXT_PUBLIC_HAS_VALUE;
const hasPermissionsValue = GLOBAL_HAS_VALUE ? JSON.parse(GLOBAL_HAS_VALUE) : [];
const isNotificationEnabled = hasPermissionsValue.includes("NEXT_PUBLIC_HAS_NOTIFICATION");
const useNotification = () => {
const requestServer = useRequest({auth: true, notification: false})
//swr config
@@ -13,7 +17,7 @@ const useNotification = () => {
})
};
const {data, mutate} = useSWR(GET_SIDEBAR_NOTIFICATION, fetcher)
const {data, mutate} = useSWR( isNotificationEnabled ? GET_SIDEBAR_NOTIFICATION : '', fetcher , {keepPreviousData:true})
const notification_count = data
//swr config