Ionic 3 to fetch user data based on id


I have two api’s one for login and another for user profile. I want to fetch data from user profile api based on the userid that i get from login api after login that i have stored in a localStorage. Now how do i pass this userid as parameter to fetch data from user profile api. Any idea?


You can take an array like let data { uid =this.uid} and then pass it with your api like(’ http://…’ data).


After login i am writting this code:
const data = JSON.parse(localStorage.getItem(‘user’));

Getting output:
{userid: “1”, status: “true”, message: “Login Success”}

Now how do i use the userid to fetch data from user profile api.


.then((data) => {
if (data != null) {
let fd = new FormData();
fd.append(‘user’, data);
.then((response) => { = response;


I am using the code in app.component.ts but getting error:
let fd=new FormData();
let x=fd.append(‘user’,data);
console.log(“Check your code”);

Error: Property ‘localStorage’ does not exist on type ‘MyApp’

In console it prints: Check your code