Fix issue of multiple auth calls from WooCommerce

This commit is contained in:
Rene Vergara 2022-12-02 14:43:52 -06:00
parent 3683567b81
commit be716378f0
Signed by: pitmutt
GPG key ID: 65122AD495A7F5B2

View file

@ -644,14 +644,26 @@ routes pipe config = do
, "message" .= ("Authorized!" :: String)
])
else do
status accepted202
Web.Scotty.json
(object
[ "authorized" .= False
, "message" .=
("ZGo shop already linked to" <>
fromMaybe "" (w_url c))
])
if (E.decodeUtf8With lenientDecode .
B64.decodeLenient . C.pack . T.unpack)
siteurl ==
fromMaybe "" (w_url c)
then do
status ok200
Web.Scotty.json
(object
[ "authorized" .= True
, "message" .= ("Already authorized." :: String)
])
else do
status accepted202
Web.Scotty.json
(object
[ "authorized" .= False
, "message" .=
("ZGo shop already linked to " <>
fromMaybe "" (w_url c))
])
else do
status accepted202
Web.Scotty.json