Backend URL moved to env variable
This commit is contained in:
12
app/api.ts
12
app/api.ts
@@ -1,8 +1,6 @@
|
||||
export const fetchCustomerData = async (id: string) => {
|
||||
const baseUrl = "http://localhost:9090";
|
||||
|
||||
try {
|
||||
const response = await fetch(`${baseUrl}/loota/${id}`, {
|
||||
const response = await fetch(`${process.env.NEXT_PUBLIC_API_URL}/loota/${id}`, {
|
||||
method: 'GET',
|
||||
});
|
||||
if (!response.ok) {
|
||||
@@ -16,10 +14,8 @@ export const fetchCustomerData = async (id: string) => {
|
||||
}
|
||||
|
||||
export const markBoxPickedUp = async (id: string) => {
|
||||
const baseUrl = "http://localhost:9090";
|
||||
|
||||
try {
|
||||
const response = await fetch(`${baseUrl}/loota/`, {
|
||||
const response = await fetch(`${process.env.NEXT_PUBLIC_API_URL}/loota/`, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
@@ -37,10 +33,8 @@ export const markBoxPickedUp = async (id: string) => {
|
||||
}
|
||||
|
||||
export const markBoxDelivered = async (id: string) => {
|
||||
const baseUrl = "http://localhost:9090";
|
||||
|
||||
try {
|
||||
const response = await fetch(`${baseUrl}/loota/`, {
|
||||
const response = await fetch(`${process.env.NEXT_PUBLIC_API_URL}/loota/`, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
|
||||
Reference in New Issue
Block a user