Skip to content

Commit

Permalink
refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
anntish committed Sep 8, 2024
1 parent d8347d8 commit af463f2
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 10 deletions.
4 changes: 0 additions & 4 deletions frontend/src/app/api.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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();
},
Expand Down
6 changes: 0 additions & 6 deletions services/backend/utils/user_required.py
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit af463f2

Please sign in to comment.