fix: add API proxy via Next rewrites + fix hardcoded localhost URLs
This commit is contained in:
@@ -77,7 +77,7 @@ export default function ConfiguracoesPage() {
|
||||
}
|
||||
|
||||
// Buscar dados da API
|
||||
const response = await fetch('http://localhost:8080/api/agency/profile', {
|
||||
const response = await fetch('/api/agency/profile', {
|
||||
headers: {
|
||||
'Authorization': `Bearer ${token}`,
|
||||
'Content-Type': 'application/json',
|
||||
@@ -156,7 +156,7 @@ export default function ConfiguracoesPage() {
|
||||
return;
|
||||
}
|
||||
|
||||
const response = await fetch('http://localhost:8080/api/agency/profile', {
|
||||
const response = await fetch('/api/agency/profile', {
|
||||
method: 'PUT',
|
||||
headers: {
|
||||
'Authorization': `Bearer ${token}`,
|
||||
@@ -224,7 +224,7 @@ export default function ConfiguracoesPage() {
|
||||
return;
|
||||
}
|
||||
|
||||
const response = await fetch('http://localhost:8080/api/auth/change-password', {
|
||||
const response = await fetch('/api/auth/change-password', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Authorization': `Bearer ${token}`,
|
||||
|
||||
@@ -4,6 +4,16 @@ const nextConfig: NextConfig = {
|
||||
experimental: {
|
||||
externalDir: true,
|
||||
},
|
||||
async rewrites() {
|
||||
return {
|
||||
beforeFiles: [
|
||||
{
|
||||
source: "/api/:path*",
|
||||
destination: "http://backend:8080/api/:path*",
|
||||
},
|
||||
],
|
||||
};
|
||||
},
|
||||
};
|
||||
|
||||
export default nextConfig;
|
||||
|
||||
Reference in New Issue
Block a user