local env setup for APIS

This commit is contained in:
Sonika 2023-12-20 13:23:55 +05:30
parent ba48c82b4c
commit 34dc16d12a
7 changed files with 7 additions and 7 deletions

View File

@ -1,7 +1,7 @@
import {useQuery} from '@tanstack/react-query' import {useQuery} from '@tanstack/react-query'
export const getUsersList = async()=>{ export const getUsersList = async()=>{
const response = await fetch(`http://localhost:8080/SonyMusicRights/users-list`); const response = await fetch(`${process.env.REACT_APP_API_URL}/users-list`);
if (!response.ok) { if (!response.ok) {
throw new Error('Failed to get User list data'); throw new Error('Failed to get User list data');
} }

View File

@ -3,7 +3,7 @@ import axios from 'axios';
export const fetchAutolinkedAssets = (searchBy:any, config:any) => { export const fetchAutolinkedAssets = (searchBy:any, config:any) => {
const fetchData = async () => { const fetchData = async () => {
const response = await axios.get(`${config.apiUrl}/autolinked-assets`, { const response = await axios.get(`${process.env.REACT_APP_API_URL}/autolinked-assets`, {
params: { params: {
searchBy searchBy
} }

View File

@ -2,7 +2,7 @@ import {useQuery, UseQueryOptions, UseQueryResult } from '@tanstack/react-query'
export const getLinkedProjectListCopy = async(searchBy:any)=>{ export const getLinkedProjectListCopy = async(searchBy:any)=>{
try { try {
const response = await fetch(`http://localhost:8080/SonyMusicRights/linked-project?searchBy=${searchBy}`); const response = await fetch(`${process.env.REACT_APP_API_URL}/linked-project?searchBy=${searchBy}`);
if (!response.ok) { if (!response.ok) {
throw new Error(`HTTP error! Status: ${response.status}`); throw new Error(`HTTP error! Status: ${response.status}`);
} }

View File

@ -1,7 +1,7 @@
import {useQuery, UseQueryOptions, UseQueryResult } from '@tanstack/react-query'; import {useQuery, UseQueryOptions, UseQueryResult } from '@tanstack/react-query';
export const getProjectListCopy = async(searchBy:any)=>{ export const getProjectListCopy = async(searchBy:any)=>{
const response = await fetch(`http://localhost:8080/SonyMusicRights/project-list?searchBy=`); const response = await fetch(`${process.env.REACT_APP_API_URL}/project-list?searchBy=`);
const projectListData = await response.json() const projectListData = await response.json()
return projectListData; return projectListData;
} }

View File

@ -1,7 +1,7 @@
import {useQuery, UseQueryOptions, UseQueryResult } from '@tanstack/react-query'; import {useQuery, UseQueryOptions, UseQueryResult } from '@tanstack/react-query';
export const getPublishedProjects = async(searchBy:any)=>{ export const getPublishedProjects = async(searchBy:any)=>{
const response = await fetch(`http://localhost:8080/SonyMusicRights/published-project?searchBy=${searchBy}`); const response = await fetch(`${process.env.REACT_APP_API_URL}/published-project?searchBy=${searchBy}`);
const projectListData = await response.json() const projectListData = await response.json()
return projectListData; return projectListData;
} }

View File

@ -1,7 +1,7 @@
import {useQuery, UseQueryOptions, UseQueryResult } from '@tanstack/react-query'; import {useQuery, UseQueryOptions, UseQueryResult } from '@tanstack/react-query';
export const getUnlinkedProjects = async(searchBy:any)=>{ export const getUnlinkedProjects = async(searchBy:any)=>{
const response = await fetch(`http://localhost:8080/SonyMusicRights/unlinked-project?searchBy=${searchBy}`); const response = await fetch(`${process.env.REACT_APP_API_URL}/unlinked-project?searchBy=${searchBy}`);
const projectListData = await response.json() const projectListData = await response.json()
return projectListData; return projectListData;
} }

View File

@ -22,7 +22,7 @@ export const useGetProjectData = () => {
import {useQuery} from '@tanstack/react-query' import {useQuery} from '@tanstack/react-query'
export const getProjectListRQ = async(searchBy: any)=>{ export const getProjectListRQ = async(searchBy: any)=>{
const response = await fetch(`http://localhost:8080/SonyMusicRights/project-list?searchBy=${searchBy}`); const response = await fetch(`${process.env.REACT_APP_API_URL}/project-list?searchBy=${searchBy}`);
if (!response.ok) { if (!response.ok) {
throw new Error('Failed to get project list data'); throw new Error('Failed to get project list data');
} }