Appropriate Local Storage for Ionic

Hi

Then resort to stringify if the response is indeed a pure array to see if that works.

My last suggestion

Tom

Declare a type for all arguments and return values of all methods. Do not use any. You will be surprised and frustrated by error messages from the build process. These will guide you to understanding.

thank you for the advice…I give up for now…I am struggling since yesterday morning…this is my git if you can think something I am missing… https://github.com/giorgionasis/storage/

Thank you very much for your interest and you time and your patience to my lack of knowledge

Hi,

this repository is unusable to replicate your problem. Too many issues in module declaration, missing files, etc.

Regards

Tom

Yes Tom,
you are right. My mistake, I merged it correctly now.

if you find time and you are in mood you can check

Thank you again

Hi

You are missing parse in package.json
(npm i --save parse)

Can you share credentials to use for testing?

search.ts:

It will be interesting to see the structure of res as part of line 60. I think the bottom-line lays in understanding the datastructure and sharing this as I cannot login and draw testdata. And I see no validation checks on the data, before you try to dump it to storage.

Your call to this.dataService.setUsers2('users'); makes no sense, as it stores ‘users’ as it sets string ‘users’ as permanent value

This assign in search.ts this.users = this.dataService.tmpusers; is an antipattern as

>    tmpusers = this.getUsers2().then((data) => {
>         this.newusers = data;
>         console.log(data);
>      }

)

returns a promise, not value.

You should not directly assign from a property in a provider, instead create a method (in data.ts etc) that returns a promise which is resolved by the caller (search.ts)

You seem to grasp the basics of Promise, but do not consistently apply this to the caller/callee pattern for all your calls.

I would not be surprised to see you trying to store a Promise in storage, which doesnt work

Regards

Tom