fix link
This commit is contained in:
@@ -6,7 +6,7 @@ import { redirect } from 'next/navigation';
|
||||
|
||||
const API_BASE_URL = process.env.NODE_ENV === 'development'
|
||||
? localDevelopmentUrl
|
||||
: 'http://no_copy_app:8080';
|
||||
: 'http://app:8080';
|
||||
|
||||
export async function logout() {
|
||||
const token = await getSessionData('token');
|
||||
@@ -109,22 +109,18 @@ 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(`
|
||||
-error-. status: ${response.status}
|
||||
-error-1. status: ${response.status}
|
||||
`);
|
||||
}
|
||||
} catch (error) {
|
||||
if (error) {
|
||||
const errors: Record<string, string> = {}
|
||||
errors['server'] = `Fetch error-> ${error}`
|
||||
errors['server'] = `-error-2 -> ${error}`
|
||||
return errors;
|
||||
}
|
||||
throw error;
|
||||
|
||||
@@ -40,7 +40,7 @@ export async function createSession(token: string, email: string) {
|
||||
expires: expiresAt,
|
||||
sameSite: 'lax',
|
||||
path: '/',
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
export async function getSessionData(type: 'token' | 'email'): Promise<string | null> {
|
||||
@@ -63,5 +63,5 @@ export async function getSessionData(type: 'token' | 'email'): Promise<string |
|
||||
|
||||
export async function deleteSession() {
|
||||
const cookieStore = await cookies()
|
||||
cookieStore.delete('session')
|
||||
cookieStore.delete('session');
|
||||
}
|
||||
Reference in New Issue
Block a user