Correct Xero token DB saving
This commit is contained in:
parent
ec4fcd3fc8
commit
74ebb9d61a
1 changed files with 2 additions and 7 deletions
|
@ -273,13 +273,8 @@ upsertToken t = do
|
||||||
let token = val t
|
let token = val t
|
||||||
case token of
|
case token of
|
||||||
Doc d -> do
|
Doc d -> do
|
||||||
if isJust (t_id t)
|
upsert (select ["address" =: t_address t] "xerotokens") d
|
||||||
then do
|
findOne (select ["address" =: t_address t] "xerotokens")
|
||||||
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")
|
|
||||||
_ -> return Nothing
|
_ -> return Nothing
|
||||||
|
|
||||||
findToken :: T.Text -> Action IO (Maybe Document)
|
findToken :: T.Text -> Action IO (Maybe Document)
|
||||||
|
|
Loading…
Reference in a new issue