I currently have a function that retrieves a bot's inventory on the Frontend
fetchBotInventory() {
this.socket.emit('fetch bot inv');
this.socket.on('bot inv', (botInventory) => {
return new Promise((resolve, reject) => {
if (botInventory.error) {
return reject(botInventory.error);
}
this.botInventory = botInventory;
resolve(botInventory);
});
});
}
It is important to note that this function returns a Promise.
When attempting to use it
fetchBotInventory() {
this.userService.fetchBotInventory().then(botInv..)
}
An error message is displayed:
Error TS2339: Property 'then' does not exist on type 'void'.
Though it is clear that it should return a Promise
. Can anyone help identify where the issue lies?