How to save the new reordered items list back to server?

#1

I guess the question title is self explanatory… I am trying to understand the logic implemented in the server-side (I am using loopBack).

In the mobile app I am using ionItemReorder… where it reorders a list of items/objects based on their indexes in the array , however, how do I save the reordered list back to the server maintaining their position in the array.

currently, I have http call methods such as, i.e. getUserEmails() // returns list of emails (objects) , addUserEmail() , deleteUserEmail() …

#2

You have to write a function that takes your new list and sends it to the server. The server has to offer an API that takes that list and saves it to the database.

#3

can I depend on the server for maintaining the array indexes ?

#4

What do you mean by that?

#5

someone told me that might not maintain the indexes position… since the item reorder is according the objects indexes in an array… so he told me its add a property order: number in each item/object in the array, so that you can rearrange it in that regard… this actually make the work more complicated thats why I was asking for a better solution