change url for docker container
This commit is contained in:
@@ -9,7 +9,21 @@ Open [http://localhost:2999](http://localhost:2999)
|
||||
|
||||
## Docker
|
||||
docker-compose down -v --rmi all
|
||||
docker-compose up
|
||||
|
||||
docker-compose up -d
|
||||
старт докера для просмотра логов внутри докера
|
||||
|
||||
docker-compose up -d --build
|
||||
обновление сборки
|
||||
|
||||
docker-compose down
|
||||
|
||||
Open [http://localhost:2998](http://localhost:2998)
|
||||
|
||||
docker run -d -p 2998:2999 --name no-copy-frontend no-copy-frontend
|
||||
|
||||
docker network ls
|
||||
|
||||
docker network connect no-copy_app-network no-copy-frontend
|
||||
|
||||
docker network inspect no-copy_app-network
|
||||
@@ -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;
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
'use server'
|
||||
import { getSessionData } from '@/app/lib/session';
|
||||
import { localDevelopmentUrl } from '@/app/lib/definitions';
|
||||
|
||||
const API_BASE_URL = process.env.NODE_ENV === 'development'
|
||||
? 'http://localhost'
|
||||
: '';
|
||||
? localDevelopmentUrl
|
||||
: 'http://no_copy_app:8080';
|
||||
|
||||
const FRUITS_URL = 'https://www.fruityvice.com/api/fruit/';
|
||||
const ALL = 'all';
|
||||
|
||||
@@ -48,3 +48,5 @@ export const loginFormSchema = z
|
||||
.min(1, { error: 'Password must be not empty' })
|
||||
.trim(),
|
||||
})
|
||||
|
||||
export const localDevelopmentUrl = 'http://localhost:81';
|
||||
+1
-1
@@ -11,7 +11,7 @@ export default async function proxy(request: NextRequest) {
|
||||
const isPublicRoute = publicRoutes.includes(path);
|
||||
|
||||
const cookie = (await cookies()).get('session')?.value;
|
||||
console.log("cookie");
|
||||
console.log("-cookie-");
|
||||
console.log(!!cookie);
|
||||
const session = await decrypt(cookie);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user