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


export const getProjectList = async()=>{
    const response = await fetch('http://localhost:8080/SonyMusicRights/project-list?searchBy=');
    if (!response.ok) {
        throw new Error('Failed to get project list data');
    }
    const projectListData = await response.json()
    return projectListData;
}

export const useGetProjectData = () => {
    return useQuery(
        {
            queryKey: ['Project-list'],
            queryFn: getProjectList,
        }
    );
} */

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

export const getProjectListRQ = async(searchBy: any)=>{
    const response = await fetch(`${process.env.REACT_APP_API_URL}/project-list?searchBy=${searchBy}`);
    if (!response.ok) {
        throw new Error('Failed to get project list data');
    }
    const projectListData = await response.json()
    return projectListData;
}

export const useGetProjectDataRQ = (searchBy:any) => {
    return useQuery(
        {
            queryKey: ['Project-list', searchBy],
            queryFn: () => getProjectListRQ(searchBy),
        }
    );
}
