Update API to env var
All checks were successful
release-image / release-image (push) Successful in 10m59s
All checks were successful
release-image / release-image (push) Successful in 10m59s
This commit is contained in:
1
makefile
1
makefile
@@ -57,6 +57,7 @@ docker-dev: #docker-build
|
|||||||
--rm \
|
--rm \
|
||||||
--name $(DOCKER_DEV_CONTAINER_NAME) \
|
--name $(DOCKER_DEV_CONTAINER_NAME) \
|
||||||
-p 3000:3000 \
|
-p 3000:3000 \
|
||||||
|
-e NEXT_PUBLIC_DRB_BASE_API_URL=$(NEXT_PUBLIC_DRB_BASE_API_URL) \
|
||||||
-v "$(PWD):/app" \
|
-v "$(PWD):/app" \
|
||||||
-v "/app/node_modules" \
|
-v "/app/node_modules" \
|
||||||
-e NODE_ENV=development \
|
-e NODE_ENV=development \
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from '@
|
|||||||
import { Dialog, DialogContent, DialogHeader, DialogTitle, DialogFooter } from '@/components/ui/dialog';
|
import { Dialog, DialogContent, DialogHeader, DialogTitle, DialogFooter } from '@/components/ui/dialog';
|
||||||
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from '@/components/ui/select';
|
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from '@/components/ui/select';
|
||||||
import { Checkbox } from '@/components/ui/checkbox';
|
import { Checkbox } from '@/components/ui/checkbox';
|
||||||
import { API_BASE_URL } from '@/constants/api';
|
import { DRB_BASE_API_URL } from '@/constants/api';
|
||||||
import { DiscordId, System, ErrorResponse } from '@/types';
|
import { DiscordId, System, ErrorResponse } from '@/types';
|
||||||
import { authAwareFetch } from '@/utils/AuthAwareFetch';
|
import { authAwareFetch } from '@/utils/AuthAwareFetch';
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,6 @@
|
|||||||
import React, { useState, useEffect } from 'react';
|
import React, { useState, useEffect } from 'react';
|
||||||
import { Button } from '@/components/ui/button';
|
import { Button } from '@/components/ui/button';
|
||||||
import { Card, CardHeader, CardTitle, CardContent } from '@/components/ui/card';
|
import { Card, CardHeader, CardTitle, CardContent } from '@/components/ui/card';
|
||||||
import { API_BASE_URL } from '@/constants/api';
|
|
||||||
import { ErrorResponse, NodeStatusResponse, System } from '@/types';
|
import { ErrorResponse, NodeStatusResponse, System } from '@/types';
|
||||||
import { Dialog, DialogContent, DialogHeader, DialogTitle, DialogFooter } from '@/components/ui/dialog';
|
import { Dialog, DialogContent, DialogHeader, DialogTitle, DialogFooter } from '@/components/ui/dialog';
|
||||||
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from '@/components/ui/select';
|
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from '@/components/ui/select';
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from '@
|
|||||||
import { Dialog, DialogContent, DialogHeader, DialogTitle, DialogFooter } from '@/components/ui/dialog';
|
import { Dialog, DialogContent, DialogHeader, DialogTitle, DialogFooter } from '@/components/ui/dialog';
|
||||||
import { Textarea } from '@/components/ui/textarea';
|
import { Textarea } from '@/components/ui/textarea';
|
||||||
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from '@/components/ui/select';
|
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from '@/components/ui/select';
|
||||||
import { API_BASE_URL } from '@/constants/api';
|
import { DRB_BASE_API_URL } from '@/constants/api';
|
||||||
import { DemodTypes, TalkgroupTag, System, ErrorResponse } from '@/types';
|
import { DemodTypes, TalkgroupTag, System, ErrorResponse } from '@/types';
|
||||||
import { authAwareFetch } from '@/utils/AuthAwareFetch';
|
import { authAwareFetch } from '@/utils/AuthAwareFetch';
|
||||||
|
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
export const API_BASE_URL = "http://172.16.100.81:5000";
|
export const DRB_BASE_API_URL: string = process.env.NEXT_PUBLIC_DRB_BASE_API_URL || "http://172.16.100.81:9000";
|
||||||
@@ -8,7 +8,7 @@ import React, {
|
|||||||
ReactNode,
|
ReactNode,
|
||||||
useCallback
|
useCallback
|
||||||
} from 'react';
|
} from 'react';
|
||||||
import { API_BASE_URL } from '@/constants/api'; // Assuming you have this
|
import { DRB_BASE_API_URL } from '@/constants/api'; // Assuming you have this
|
||||||
import { authAwareFetch } from '@/utils/AuthAwareFetch'; // Import authAwareFetch
|
import { authAwareFetch } from '@/utils/AuthAwareFetch'; // Import authAwareFetch
|
||||||
|
|
||||||
// Define your User and UserRoles types if not already in types.ts
|
// Define your User and UserRoles types if not already in types.ts
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
// utils/AuthAwareFetch.ts
|
// utils/AuthAwareFetch.ts
|
||||||
import { API_BASE_URL } from '@/constants/api'; // Make sure this path is correct
|
import { DRB_BASE_API_URL } from '@/constants/api'; // Make sure this path is correct
|
||||||
|
|
||||||
interface AuthAwareFetchOptions extends RequestInit {
|
interface AuthAwareFetchOptions extends RequestInit {
|
||||||
token?: string;
|
token?: string;
|
||||||
@@ -20,7 +20,7 @@ export const authAwareFetch = async (
|
|||||||
|
|
||||||
console.log(requestHeaders, rest, url)
|
console.log(requestHeaders, rest, url)
|
||||||
|
|
||||||
const response = await fetch(`${API_BASE_URL}${url}`, {
|
const response = await fetch(`${DRB_BASE_API_URL}${url}`, {
|
||||||
headers: requestHeaders,
|
headers: requestHeaders,
|
||||||
...rest,
|
...rest,
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user