Skip to content

Commit 590b4b6

Browse files
authored
Fixed Issue with predefined params (/:id)
1 parent 17b5cd2 commit 590b4b6

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/actions/Action.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,8 @@ export default class Action {
5050
static transformParams (type, model, config = {}) {
5151
let endpoint = `${model.methodConf.http.url}${model.methodConf.methods[type].http.url}`;
5252
let params = _.map(endpoint.match(/(\/?)(\:)([A-z]*)/gm), (param) => { return param.replace('/', '') })
53-
_.forEach(params, (param) => { endpoint = endpoint.replace(param, config.params[param.replace(':')] ? foundParam : '').replace('//', '/') })
53+
54+
_.forEach(params, (param) => { endpoint = endpoint.replace(param, config.params[param.replace(':', '')] || '').replace('//', '/') })
5455
if (config.query) endpoint += `?${Object.keys(config.query).map(k => `${encodeURIComponent(k)}=${encodeURIComponent(config.query[k])}`).join('&')}`;
5556
return endpoint;
5657
}

0 commit comments

Comments
 (0)