Page 1 of 1

Changing local Storage in JS code for Service URL

Posted: Mon Mar 02, 2015 3:23 pm
by Mark Wong

var image = localStorage.getItem(Image_fileUrl);
var newurl = 'https://api.appery.io/rest/1/db/files/' + image ;
localStorage.setItem("Image_fileUrl", newurl);

Here is my code, I want to use it for calling the read service url by mapping the Image_fileUrl service to the request of url.
First, the service which get the users information from user collection will response back and map to the storage Image_fileUrl.
Nothing wrongs until this point..
I try to add https://api.appery.io/rest/1/db/files/ in front of it and give to the request of url of the read service, but its not working, it remains the same as I got from user collection


Changing local Storage in JS code for Service URL

Posted: Tue Mar 03, 2015 8:25 am
by Alena Prykhodko

Hi,

1) You are using wrong storage variable, if you have mapped the response to it in previous service. Use it like this:
pre
var image = Apperyio.storage.Image_fileUrl.get();/pre

2) You will never invoke service with this url , if it is in localstorage variable.
2.1)You need Settings service with parameter 'new_url'. After the line above set new url like:

preSettings.new_url = image;/pre

2.2) In the service settings tab, choose settings service
2.3) In the url parameter place pre{new_url}/pre