Created
May 28, 2023 07:35
-
-
Save nemo0/9201496ceff257707bb4ec8afc00c9ad to your computer and use it in GitHub Desktop.
Call.js Authenticate Function
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const authenticate = async () => { | |
try { | |
const result = await new Promise((resolve, reject) => { | |
SendBirdCall.authenticate({ userId }, (res, error) => { | |
if (error) { | |
reject(error); | |
} else { | |
resolve(res); | |
} | |
}); | |
}); | |
console.log(`Authenticated as ${userId}`); | |
return result; | |
} catch (error) { | |
console.log('Error authenticating'); | |
throw error; | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment