by making request to WebAPI I expect to receive string array with several values (units of measurement in this case) ["KGM", "MTR"]
Unfortunately in response I'm receiving array of resources and within array of chars
[0] Resource
[0]: "K"
[1]: "G"
[2]: "M"
[1] Resource
[0]: "M"
[1]: "T"
[2]: "R"
Here is request which I do and how I'm carry the response
var provider = this.resource(WebAPIDataUrl, {}
, {
GetData: {
method: 'GET'
, params: {
action: "GetData"
}, isArray: true
, headers: {
'Token': this.window.sessionStorage.getItem("Token")
}
}
});
var _success = function (resource: string[]) {
_unitsOfMeasurements = Object.keys(resource);
};
var _error = function () {
};
provider.GetData(_success, _error);
I have also created a hook by using transformResponse
to be sure that incoming data is in proper format and it's ok:
transformResponse: function(data, headers){
return data;
}
data == '["KGM", "MTR"]'
So question is how should treat response to have nice string[] ?