From 0dd3d818c36b12010c27775e0a79349718364ba6 Mon Sep 17 00:00:00 2001 From: zsloan Date: Thu, 8 Jun 2023 16:52:43 +0000 Subject: Fix bug by providing anon_id to collections/add --- wqflask/wqflask/collect.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/wqflask/wqflask/collect.py b/wqflask/wqflask/collect.py index eaed239d..87f7948d 100644 --- a/wqflask/wqflask/collect.py +++ b/wqflask/wqflask/collect.py @@ -82,10 +82,17 @@ def collections_add(): lambda _err: tuple(), lambda colls: tuple(colls)) + no_token_get( f"oauth2/user/collections/{anon_id}/list").either( lambda _err: tuple(), lambda colls: tuple(colls)) + + def __create_new_coll_error__(error): + err = process_error(error) + flash(f"{err['error']}:{err['error_description']}", "alert-danger") + return redirect("/") + if len(collections) < 1: new_coll = client.post( "oauth2/user/collections/new", json={ + "anon_id": str(anon_id), "name": "Your Default Collection", "traits": [] }).either(__create_new_coll_error__, lambda coll: coll) -- cgit v1.2.3