fix: all pages now use the right backend url + backend uses .env of root too

This commit is contained in:
theoleuthardt 2025-02-24 16:22:28 +01:00
parent 0d92719258
commit 607d496f2a
11 changed files with 22 additions and 14 deletions

View file

@ -6,7 +6,7 @@ dotenv.config({ path: "../.env" });
const nextConfig: NextConfig = {
output: "standalone",
env: {
backend_url: process.env.NEXT_PUBLIC_BACKEND_URL,
NEXT_PUBLIC_BACKEND_URL: process.env.NEXT_PUBLIC_BACKEND_URL,
},
};

View file

@ -32,10 +32,13 @@ export default function BGRemover() {
setLoading(true);
try {
const response = await fetch(process.env.backend_url + "/api/remove-bg", {
method: "POST",
body: formData,
});
const response = await fetch(
process.env.NEXT_PUBLIC_BACKEND_URL + "/api/remove-bg",
{
method: "POST",
body: formData,
},
);
if (!response.ok) {
console.error(`Error: ${response.statusText}`);

View file

@ -57,7 +57,7 @@ export default function DocConverter() {
try {
const response = await fetch(
process.env.backend_url + "/api/libre-convert",
process.env.NEXT_PUBLIC_BACKEND_URL + "/api/libre-convert",
{
method: "POST",
body: formData,

View file

@ -24,7 +24,7 @@ export default function PasswordGenerator() {
try {
const response = await fetch(
process.env.backend_url + "/api/password-generate",
process.env.NEXT_PUBLIC_BACKEND_URL + "/api/password-generate",
{
method: "POST",
headers: {

View file

@ -26,7 +26,7 @@ export default function QrCodeGenerator() {
try {
const response = await fetch(
process.env.backend_url + "/api/generate-qrcode",
process.env.NEXT_PUBLIC_BACKEND_URL + "/api/generate-qrcode",
{
method: "POST",
headers: {

View file

@ -17,7 +17,7 @@ export default function RegexTester() {
try {
const response = await fetch(
process.env.backend_url + "/api/regex-test",
process.env.NEXT_PUBLIC_BACKEND_URL + "/api/regex-test",
{
method: "POST",
headers: {

View file

@ -18,7 +18,7 @@ export default function RgbToHex() {
try {
const response = await fetch(
process.env.backend_url + "/api/color-convert",
process.env.NEXT_PUBLIC_BACKEND_URL + "/api/color-convert",
{
method: "POST",
headers: {

View file

@ -19,7 +19,7 @@ export default function TMZConverter() {
try {
const response = await fetch(
process.env.backend_url + "/api/tmz-convert",
process.env.NEXT_PUBLIC_BACKEND_URL + "/api/tmz-convert",
{
method: "POST",
headers: {

View file

@ -57,7 +57,7 @@ export default function DocConverter() {
try {
const response = await fetch(
process.env.backend_url + "/api/video-to-audio",
process.env.NEXT_PUBLIC_BACKEND_URL + "/api/video-to-audio",
{
method: "POST",
body: formData,

View file

@ -16,7 +16,7 @@ export default function WordCounter() {
try {
const response = await fetch(
process.env.backend_url + "/api/word-counter",
process.env.NEXT_PUBLIC_BACKEND_URL + "/api/word-counter",
{
method: "POST",
headers: {