From 74ebb9d61aaa1147ae91e5ac450cf61d6ed394c8 Mon Sep 17 00:00:00 2001 From: Rene Vergara Date: Thu, 8 Sep 2022 10:52:32 -0500 Subject: [PATCH] Correct Xero token DB saving --- src/Xero.hs | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/src/Xero.hs b/src/Xero.hs index 3373409..2fb8745 100644 --- a/src/Xero.hs +++ b/src/Xero.hs @@ -273,13 +273,8 @@ upsertToken t = do let token = val t case token of Doc d -> do - if isJust (t_id t) - then do - upsert (select ["address" =: t_address t] "xerotokens") d - findOne (select ["address" =: t_address t] "xerotokens") - else do - insert_ "xerotokens" d - findOne (select ["address" =: t_address t] "xerotokens") + upsert (select ["address" =: t_address t] "xerotokens") d + findOne (select ["address" =: t_address t] "xerotokens") _ -> return Nothing findToken :: T.Text -> Action IO (Maybe Document)