Add urlPrefix to CommonGeneratorOptions

This commit is contained in:
Freezeboy 2015-07-27 15:21:58 +02:00
parent 2cf2d08cd3
commit 8b927e7f0d
4 changed files with 6 additions and 0 deletions

View File

@ -128,6 +128,7 @@ generateAngularJSWith ngOptions opts req = "\n" <>
method = req ^. reqMethod
url = if url' == "'" then "'/'" else url'
url' = "'"
++ urlPrefix opts
++ urlArgs
++ queryArgs

View File

@ -34,6 +34,7 @@ data CommonGeneratorOptions = CommonGeneratorOptions
, successCallback :: String -- ^ name of the callback parameter when the request was successful
, errorCallback :: String -- ^ name of the callback parameter when the request reported an error
, moduleName :: String -- ^ namespace on which we define the js function (empty mean local var)
, urlPrefix :: String -- ^ a prefix we should add to the Url in the JS codegen
}
-- | Default options.
@ -45,6 +46,7 @@ data CommonGeneratorOptions = CommonGeneratorOptions
-- > , successCallback = "onSuccess"
-- > , errorCallback = "onError"
-- > , moduleName = ""
-- > , urlPrefix = ""
-- > }
-- @
defCommonGeneratorOptions :: CommonGeneratorOptions
@ -55,6 +57,7 @@ defCommonGeneratorOptions = CommonGeneratorOptions
, successCallback = "onSuccess"
, errorCallback = "onError"
, moduleName = ""
, urlPrefix = ""
}
type Arg = String

View File

@ -81,6 +81,7 @@ generateJQueryJSWith opts req = "\n" <>
method = req ^. reqMethod
url = if url' == "'" then "'/'" else url'
url' = "'"
++ urlPrefix opts
++ urlArgs
++ queryArgs

View File

@ -88,6 +88,7 @@ generateVanillaJSWith opts req = "\n" <>
method = req ^. reqMethod
url = if url' == "'" then "'/'" else url'
url' = "'"
++ urlPrefix opts
++ urlArgs
++ queryArgs