Skip to content
This repository has been archived by the owner on Nov 24, 2024. It is now read-only.

Commit

Permalink
hotfix
Browse files Browse the repository at this point in the history
  • Loading branch information
deminearchiver committed Nov 24, 2024
1 parent 5b70f0a commit 49f38aa
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
13 changes: 7 additions & 6 deletions apps/backend/src/lib/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,13 @@ def get_db() -> DB:
db = g._database = DB("db.db")
db.connect()
return db



@app.after_request
def apply_caching(response: Response):
response.headers['Access-Control-Allow-Credentials'] = 'true'
response.headers['Content-Security-Policy'] = 'upgrade-insecure-requests'
return response


Expand Down Expand Up @@ -69,22 +70,22 @@ def get_data():
db.add_answer_to_user_history(_id=user_id, answer_id=answer._id)

print(f"answer: {answer.to_json()}")

return make_on_event_json_response(db, user_id)


@app.route("/create_user", methods=['POST'])
@cross_origin()
def create_user():
user_id = request.cookies.get('user_id')
db = get_db()

if not user_id:
user_id = str(uuid.uuid4())
db.create_user(_id=user_id, money=15000)

user = db.get_user(user_id)

data = return_last_data(user)
response = make_response(jsonify(data))

Expand Down
6 changes: 4 additions & 2 deletions apps/frontend/src/routes/play/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ const createSession = async () => {
url,
{
method: "POST",
credentials: "include",
// credentials: "include",
mode: "no-cors",
headers: {
"Accept": "application/json",
"Content-Type": "application/json"
Expand All @@ -51,7 +52,8 @@ const fetchNextEvent = async (id?: string) => {
url,
{
method: "POST",
credentials: "include",
// credentials: "include",
mode: "no-cors",
headers: {
"Accept": "application/json",
"Content-Type": "application/json"
Expand Down

0 comments on commit 49f38aa

Please sign in to comment.