Fix auth URLs to use relative paths instead of absolute NEXT_PUBLIC_API_URL
Some checks failed
continuous-integration/drone/push Build is failing
Some checks failed
continuous-integration/drone/push Build is failing
- Change login page to use /api/auth/login/ instead of absolute URL - Change register page to use /api/auth/register/ instead of absolute URL - This fixes the 404 error with /auth/undefined/api/auth/login/ path - Now uses Next.js rewrites from next.config.js correctly
This commit is contained in:
@@ -23,7 +23,7 @@ export default function LoginPage() {
|
||||
setApiError(null)
|
||||
try {
|
||||
const res = await fetch(
|
||||
`${process.env.NEXT_PUBLIC_API_URL}/api/auth/login/`,
|
||||
`/api/auth/login/`,
|
||||
{
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
|
||||
@@ -46,8 +46,7 @@ export default function RegisterPage() {
|
||||
}
|
||||
|
||||
try {
|
||||
const API = process.env.NEXT_PUBLIC_API_URL || 'https://links.shareon.kr'
|
||||
const response = await fetch(`${API}/api/auth/register/`, {
|
||||
const response = await fetch(`/api/auth/register/`, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
|
||||
Reference in New Issue
Block a user