feat(F-054): completed feature

This commit is contained in:
chattie
2026-08-19 13:15:30 +02:00
parent 6a74f5ede6
commit de41a42d88
17 changed files with 446 additions and 100 deletions

View File

@@ -1,11 +1,13 @@
import { NextRequest, NextResponse } from 'next/server';
const API = process.env.NEXT_PUBLIC_API_URL ?? 'http://127.0.0.1:3000';
export async function POST(request: NextRequest) {
try {
const body = await request.json();
const { email, password } = body;
const backendRes = await fetch('http://127.0.0.1:3000/auth/login', {
const backendRes = await fetch(`${API}/auth/login`, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ email, password }),

View File

@@ -1,5 +1,7 @@
import { NextRequest, NextResponse } from 'next/server';
const API = process.env.NEXT_PUBLIC_API_URL ?? 'http://127.0.0.1:3000';
export async function GET(request: NextRequest) {
const sessionToken = request.cookies.get('session_token')?.value;
@@ -8,7 +10,7 @@ export async function GET(request: NextRequest) {
}
try {
const backendRes = await fetch('http://127.0.0.1:3000/auth/me', {
const backendRes = await fetch(`${API}/auth/me`, {
headers: {
Cookie: `session_token=${sessionToken}`,
},

View File

@@ -1,11 +1,13 @@
import { NextRequest, NextResponse } from 'next/server';
const API = process.env.NEXT_PUBLIC_API_URL ?? 'http://127.0.0.1:3000';
export async function POST(request: NextRequest) {
try {
const body = await request.json();
const { email, password } = body;
const backendRes = await fetch('http://127.0.0.1:3000/auth/register', {
const backendRes = await fetch(`${API}/auth/register`, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ email, password }),