import {useQuery} from '@tanstack/react-query'

export const getIntranetUsersList = async()=>{
    const response = await fetch(`${process.env.REACT_APP_API_URL}/intranet-users-list`);
    if (!response.ok) {
        throw new Error('Failed to get User list data');
    }
    const UserListData = await response.json()
    return UserListData;
}

export const useGetIntranetUsersData = () => {
    return useQuery(
        {
            queryKey: ['IntranetUsers-list'],
            queryFn: () => getIntranetUsersList(),
        }
    );
}