Mark Wong
Posts: 0
Joined: Sat Feb 14, 2015 7:47 am

Changing local Storage in JS code for Service URL

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

Alena Prykhodko
Posts: 0
Joined: Tue Apr 09, 2013 7:36 am

Changing local Storage in JS code for Service URL

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

Return to “Issues”