javascript wrap async function in promise