Merge pull request #172 from freezeboy/add-url-prefix
Add urlPrefix to CommonGeneratorOptions
This commit is contained in:
commit
4ff9697ed7
4 changed files with 6 additions and 0 deletions
|
@ -128,6 +128,7 @@ generateAngularJSWith ngOptions opts req = "\n" <>
|
|||
method = req ^. reqMethod
|
||||
url = if url' == "'" then "'/'" else url'
|
||||
url' = "'"
|
||||
++ urlPrefix opts
|
||||
++ urlArgs
|
||||
++ queryArgs
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -81,6 +81,7 @@ generateJQueryJSWith opts req = "\n" <>
|
|||
method = req ^. reqMethod
|
||||
url = if url' == "'" then "'/'" else url'
|
||||
url' = "'"
|
||||
++ urlPrefix opts
|
||||
++ urlArgs
|
||||
++ queryArgs
|
||||
|
||||
|
|
|
@ -88,6 +88,7 @@ generateVanillaJSWith opts req = "\n" <>
|
|||
method = req ^. reqMethod
|
||||
url = if url' == "'" then "'/'" else url'
|
||||
url' = "'"
|
||||
++ urlPrefix opts
|
||||
++ urlArgs
|
||||
++ queryArgs
|
||||
|
||||
|
|
Loading…
Reference in a new issue