Merge pull request #172 from freezeboy/add-url-prefix

Add urlPrefix to CommonGeneratorOptions
This commit is contained in:
Alp Mestanogullari 2015-07-28 15:53:48 +02:00
commit 4ff9697ed7
4 changed files with 6 additions and 0 deletions

View file

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

View file

@ -34,6 +34,7 @@ data CommonGeneratorOptions = CommonGeneratorOptions
, successCallback :: String -- ^ name of the callback parameter when the request was successful , 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 , 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) , 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. -- | Default options.
@ -45,6 +46,7 @@ data CommonGeneratorOptions = CommonGeneratorOptions
-- > , successCallback = "onSuccess" -- > , successCallback = "onSuccess"
-- > , errorCallback = "onError" -- > , errorCallback = "onError"
-- > , moduleName = "" -- > , moduleName = ""
-- > , urlPrefix = ""
-- > } -- > }
-- @ -- @
defCommonGeneratorOptions :: CommonGeneratorOptions defCommonGeneratorOptions :: CommonGeneratorOptions
@ -55,6 +57,7 @@ defCommonGeneratorOptions = CommonGeneratorOptions
, successCallback = "onSuccess" , successCallback = "onSuccess"
, errorCallback = "onError" , errorCallback = "onError"
, moduleName = "" , moduleName = ""
, urlPrefix = ""
} }
type Arg = String type Arg = String

View file

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

View file

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