Weird behvaior NEXT.JS app

I just deployed my app on railway, everything working expect next builtin api. When i'm trying to contact api it just redirect me to for example /auth/login - when api should just get post request in background and procced to contact backend which is too deployed on railway. When testing on localhost everything working fine.
2 Replies
Percy
Percy2y ago
Project ID: N/A
gravgor
gravgorOP2y ago
a3964f0 example:
const request = await fetch('/api/auth/login', {
method: 'POST',
headers: { 'Content-Type': 'application/json'
},
body: JSON.stringify(data)
})
const json = await request.json()
if (json.success === true) {
window.sessionStorage.setItem('userEmail', json.email)
router.push(`/${locale}/platform`)
const request = await fetch('/api/auth/login', {
method: 'POST',
headers: { 'Content-Type': 'application/json'
},
body: JSON.stringify(data)
})
const json = await request.json()
if (json.success === true) {
window.sessionStorage.setItem('userEmail', json.email)
router.push(`/${locale}/platform`)
And this should send post request to next api /auth/login but instead i get redirect to domain.com/auth/login And when testing this on local build still working fine only on railway I don't know - now work without problem
Want results from more Discord servers?
Add your server