mirror of
https://github.com/ilyakooo0/servant-reflex.git
synced 2024-09-11 07:15:29 +03:00
Made servant-auth optional
This commit is contained in:
parent
f76dbeb941
commit
39d6ff2531
@ -15,6 +15,11 @@ Flag Example
|
||||
description: Enable example
|
||||
default: False
|
||||
|
||||
Flag servant-auth
|
||||
description: Enable servant-auth
|
||||
default: True
|
||||
manual: False
|
||||
|
||||
library
|
||||
exposed-modules:
|
||||
Servant.Common.BaseUrl
|
||||
@ -40,11 +45,14 @@ library
|
||||
reflex-dom-core >= 0.6 && < 0.7,
|
||||
safe >= 0.3.9 && < 0.4,
|
||||
servant >= 0.16 && < 0.18,
|
||||
servant-auth >= 0.2.1 && < 0.4,
|
||||
string-conversions >= 0.4 && < 0.5,
|
||||
text >= 1.2 && < 1.3,
|
||||
transformers >= 0.4 && < 0.6
|
||||
|
||||
if flag(servant-auth)
|
||||
build-depends:
|
||||
servant-auth >= 0.2.1 && < 0.4
|
||||
|
||||
ghc-options: -Wall -fwarn-tabs -funbox-strict-fields
|
||||
|
||||
default-language: Haskell2010
|
||||
|
@ -61,7 +61,6 @@ import Servant.API ((:<|>) (..), (:>), BasicAuth,
|
||||
ToHttpApiData (..), Vault, Verb,
|
||||
contentType)
|
||||
import Servant.API.Description (Summary)
|
||||
import qualified Servant.Auth as Auth
|
||||
|
||||
import Reflex.Dom.Core (Dynamic, Event, Reflex,
|
||||
XhrRequest (..), XhrResponse (..),
|
||||
@ -90,6 +89,11 @@ import Servant.Common.Req (ClientOptions(..),
|
||||
reqTag,
|
||||
qParams, withCredentials)
|
||||
|
||||
#ifdef servant-auth
|
||||
|
||||
import qualified Servant.Auth as Auth
|
||||
|
||||
#endif
|
||||
|
||||
-- * Accessing APIs as a Client
|
||||
|
||||
@ -610,6 +614,9 @@ for empty and one for non-empty lists).
|
||||
|
||||
-- @HasCookieAuth auths@ is nominally a redundant constraint, but ensures
|
||||
-- we're not trying to rely on cookies when the API does not use them.
|
||||
|
||||
#ifdef servant-auth
|
||||
|
||||
instance (HasCookieAuth auths, HasClient t m api tag) => HasClient t m (Auth.Auth auths a :> api) tag where
|
||||
|
||||
type Client t m (Auth.Auth auths a :> api) tag = Client t m api tag
|
||||
@ -623,3 +630,4 @@ type family HasCookieAuth xs :: Constraint where
|
||||
|
||||
class CookieAuthNotEnabled
|
||||
|
||||
#endif
|
Loading…
Reference in New Issue
Block a user