Skip to content

Promise data array is not in a correct order. #859

@ronaldaug

Description

@ronaldaug

Is there any query or method that I can get the correct order of array?
If I add an item, it should store as the last item in the array. But it's not working like that. ( Probably, it's only happen at me? )

Currently, I have to reorder the array by sorting the times like this

hoodie.store.findAll().then(function (data) {
	data.sort((a,b)=>return b.createdAt - a.createdAt);
})

And one more question how do I get current username/data?
I try something like this and it just return promise.

var currentUsername = hoodie.account.get().then(function(e){
        return e.username;
})
console.log(currentUsername);

Is there any easy way to get username as a string?
Probably something like this var currentUsername = hoddie.account.get('username');
Thanks in advance.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions