From af463f2d938f48cef2f0459d834c59d14188dda1 Mon Sep 17 00:00:00 2001 From: anna Date: Mon, 9 Sep 2024 00:51:09 +0300 Subject: [PATCH] refactor --- frontend/src/app/api.tsx | 4 ---- services/backend/utils/user_required.py | 6 ------ 2 files changed, 10 deletions(-) diff --git a/frontend/src/app/api.tsx b/frontend/src/app/api.tsx index 218d70f..2d4075b 100644 --- a/frontend/src/app/api.tsx +++ b/frontend/src/app/api.tsx @@ -5,10 +5,6 @@ export const api = { const response = await fetch(`${API_URL}/conversation/create`, { method: 'POST', credentials: "include", - headers: { - 'Content-Type': 'application/json', - }, - body: JSON.stringify({ user_id: userId }), }); return response.json(); }, diff --git a/services/backend/utils/user_required.py b/services/backend/utils/user_required.py index fbe5c0f..2c48190 100644 --- a/services/backend/utils/user_required.py +++ b/services/backend/utils/user_required.py @@ -1,23 +1,17 @@ import os import uuid -from dotenv import load_dotenv from flask import make_response, request -load_dotenv() access_control_allow_origin = os.environ.get('ACCESS_CONTROL_ALLOW_ORIGIN') def user_required(f): def decorated_function(*args, **kws): response = f(*args, **kws) response = make_response(response) - if not request.cookies.get('user_id'): response.set_cookie('user_id', value=str(uuid.uuid4()), max_age=60 * 60 * 24 * 365 * 2, httponly = True) - response.headers.add('Access-Control-Allow-Origin', access_control_allow_origin) response.headers.add('Access-Control-Allow-Credentials', 'true') - return response - return decorated_function \ No newline at end of file