Page 1 of 1

put request (update service) onSuccess get data from same updated record

Posted: Sun Apr 12, 2015 1:38 pm
by EJLD

Hi There, I m very bad to find a 'great title' (at least it's descriptive).

I am updating a field of a given record with a PUT request using service mapping.
all that works fine.

however, I thought that onSuccess of that above PUT request, I could GET data from the same record but other fields via mapping.

the console throws me an error msg as follows :
Uncaught Error: Attempt to access Object by index: 0
sources describes:
if (_.isTrueObject(data) && arrayLevel) throw new Error("Attempt to access Object by index: " + pathHead);

i structured the mapping as a usual GET request with
body / $ as array / $ as object / fieldName as string
shall hv I done it different ?

any idea ?
best,
Eric


put request (update service) onSuccess get data from same updated record

Posted: Sun Apr 12, 2015 3:42 pm
by Bruce Stuart

Eric,
Not sure if this is your issue or not ... But if your service returns only one row ... Then you can access the field by data.fieldname ... Instead of data.fieldname.
Best,
Bruce


put request (update service) onSuccess get data from same updated record

Posted: Sun Apr 12, 2015 11:46 pm
by EJLD

Hi Bruce, thks for your advice.
it can be something like this.
I'll check this out.
hv a good day!
Eric