-
Notifications
You must be signed in to change notification settings - Fork 30
Open
Labels
Description
How can we help?
Hi,
I was updating my project from v2 to v3 and I run into an issue with
OneSignal.Notifications.requestPermission()
When and how should be this method be used? When I ran this method the OneSignal looked stuck.
Here is the code that I tried to run:
const init = () ->> {
OneSignal.init({ appId: AppId });
}
const login = (user: string) => {
console.log('Requesting permission');
await OneSignal.Notifications.requestPermission();
console.log('Permission successfully requested'); //this consol.log will will not be printed
await OneSignal.login(user);
}
but if I run the same function without await the function run and user is logged into OneSignal and notifications are received.
const login = (user: string) => {
console.log('Requesting permission');
OneSignal.Notifications.requestPermission();
console.log('Permission successfully requested'); // console.log will be printed
await OneSignal.login(user);
}
Is there an reason why it gets stuck on this awaited method?
Thank you in advance for any response.