So I am porting my slackbot from python over to Node and am having issues with async/await. My function is completely ignoring the await keyword and the linter is giving me the following error:
'await' has no effect on the type of this expression.
Here is the code:
function list_channels(access_token) {
fetch(`https://slack.com/api/channels.list?token=${access_token}`)
.then((r) => {
r.json()
.then(c => {
let channels = {}
for (channel of c.channels) {
channels[channel.name] = channel.id
}
return new Promise(resolve => {
console.log("_______resolve", channels)
resolve(channels)
})
})
})
}
const wrapper = {
list_channels: list_channels
}
module.exports = wrapper
and
app.get('/admin', async (req, res) => {
const user = req.user
let a = await wrapper.list_channels(code)
res.send({hmm:a})
})
When I call the route, I get {}