greg keys
Posts: 0
Joined: Wed Sep 25, 2013 4:32 am

echo override at run time doesnt seem to be working

I'm trying to add a sort of page cache for an activity stream where if it has called and stored it in localStorage recently then load that using a dedicated echo service mappped to the page otherwise load it from the REST api and then store it in localStorage, however the echo override does not seem to be working.

here is the code I have on pageshow for the activity page

var cache = localStorage.getItem('cache_activities');
if(cache!=null){
console.log('loading cache');
//echo_activities.requestOptions.echo = JSON.stringify(cache);
echo_activities.requestOptions.echo = cache;
echo_activities.execute({});
}else{
console.log('executing service');
activity_user_service.execute({});
}

when it loads from cache I get a parsererror

I can add a resonse to the services default echo but that doesnt help since we want to retrieve it from storage

Kateryna Grynko
Posts: 0
Joined: Thu Nov 15, 2012 9:13 am

echo override at run time doesnt seem to be working

Hi Greg,

Where do you get the error? What is the value of the object where the error occurs? http://docs.appery.io/documentation/d...

greg keys
Posts: 0
Joined: Wed Sep 25, 2013 4:32 am

echo override at run time doesnt seem to be working

the error comes when echo_activities.execute({}); is executed, i have a console.log on the onError method

The value of the object is the JSON.strigified data retrieved from the onComplete method of the REST call to activity_user_service.execute({}); it is stored in the localStorage variable, I console.logged echo_activities.__requestOptions.echo immediately before echo_activities.execute({}); and it is the proper object, I tested it against a JSON validator and it all looks great, it just seems that the echo object is not being used when echo_activities.execute({}); is called

Kateryna Grynko
Posts: 0
Joined: Thu Nov 15, 2012 9:13 am

echo override at run time doesnt seem to be working

Hi,

If you want to output Request mapping data to the console, then you should know this is an array of objects. you can access its elements by the index restservice1.__requestMapping, and not as an object.

greg keys
Posts: 0
Joined: Wed Sep 25, 2013 4:32 am

echo override at run time doesnt seem to be working

ok but why isnt the echo override working?

when I do this
console.log(echo_activities.__requestOptions.echo)

it outputs the object that I assigned it but its not being used when the service is executed

Kateryna Grynko
Posts: 0
Joined: Thu Nov 15, 2012 9:13 am

echo override at run time doesnt seem to be working

Hi Greg,

Could you please share the app and tell us where to find the issue?

greg keys
Posts: 0
Joined: Wed Sep 25, 2013 4:32 am

echo override at run time doesnt seem to be working

Is there a private way to share it with you, our client would not like anything publicly shared

greg keys
Posts: 0
Joined: Wed Sep 25, 2013 4:32 am

echo override at run time doesnt seem to be working

which email should I use?

Return to “Issues”