change url for docker container

This commit is contained in:
smanylov
2025-12-03 21:05:09 +07:00
parent b78a392d11
commit ac2fd7c8e0
5 changed files with 32 additions and 13 deletions
+9 -7
View File
@@ -1,12 +1,12 @@
'use server'
import { SignupFormSchema, loginFormSchema } from '@/app/lib/definitions';
import {SignupFormSchema, loginFormSchema, localDevelopmentUrl} from '@/app/lib/definitions';
import { createSession, deleteSession, getSessionData } from '@/app/lib/session';
import { redirect } from 'next/navigation';
const API_BASE_URL = process.env.NODE_ENV === 'development'
? 'http://localhost'
: 'http://no-copy-app:8080';
? localDevelopmentUrl
: 'http://no_copy_app:8080';
export async function logout() {
const token = await getSessionData('token');
@@ -109,20 +109,22 @@ export async function registration(
}
});
console.log('Status:', response.status);
console.log('Status text:', response.statusText);
if (response.ok) {
let parsed = await response.json();
await createSession(parsed.token, email);
} else {
throw new Error(`
Something went wrong. from server
${API_BASE_URL}/api/auth/register
-error-. status: ${response.status}
`);
}
} catch (error) {
if (error) {
const errors: Record<string, string> = {}
errors['server'] = `? ${API_BASE_URL}/api/auth/register error-- ${error}`
errors['server'] = `Fetch error-> ${error}`
return errors;
}
throw error;