Queueing
If we need to send requests in a specific order one by one, we can use the queue option. This option is especially useful for sending or downloading large data.
Setup
export const postFile = builder.createCommand()({
endpoint: "/files",
queued: true,
});
Example
The example is written in typescript, but it also works in React hooks.
// Multiple files being send
postFile.send();
postFile.send();
postFile.send();
postFile.send();
// they will be send one by one awaiting for previous to be finished