Skip to content

Commit

Permalink
fix: NotFound
Browse files Browse the repository at this point in the history
No document to update when connecting fb
  • Loading branch information
devxpy committed Feb 29, 2024
1 parent b7f1823 commit d675248
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
6 changes: 6 additions & 0 deletions daras_ai_v2/db.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
import typing

if typing.TYPE_CHECKING:
from google.cloud import firestore


FIREBASE_SESSION_COOKIE = "firebase_session"
ANONYMOUS_USER_COOKIE = "anonymous_user"

Expand Down
4 changes: 3 additions & 1 deletion routers/facebook_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,9 @@ def fb_connect_redirect(request: Request):
)
user_access_token = _get_access_token_from_code(code)

db.get_user_doc_ref(request.user.uid).update({"fb_access_token": user_access_token})
db.get_user_doc_ref(request.user.uid).set(
{"fb_access_token": user_access_token}, merge=True
)

fb_pages = get_currently_connected_fb_pages(user_access_token)
if not fb_pages:
Expand Down

0 comments on commit d675248

Please sign in to comment.