Correct Xero token DB saving

This commit is contained in:
Rene Vergara 2022-09-08 10:52:32 -05:00
parent ec4fcd3fc8
commit 74ebb9d61a
Signed by: pitmutt
GPG key ID: 65122AD495A7F5B2

View file

@ -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)