0
0
Fork 0

Fixed ESLint error (#15214)

* eslint --fix

* fix consistent-return

* fix promise/catch-or-return

* ignore import rule
This commit is contained in:
abcang 2020-11-24 01:35:14 +09:00 committed by GitHub
parent 4ae22c4613
commit a2da02626e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 19 additions and 13 deletions

View file

@ -3,6 +3,7 @@
const checkNotificationPromise = () => {
try {
// eslint-disable-next-line promise/catch-or-return
Notification.requestPermission().then();
} catch(e) {
return false;
@ -22,7 +23,7 @@ const handlePermission = (permission, callback) => {
export const requestNotificationPermission = (callback) => {
if (checkNotificationPromise()) {
Notification.requestPermission().then((permission) => handlePermission(permission, callback));
Notification.requestPermission().then((permission) => handlePermission(permission, callback)).catch(console.warn);
} else {
Notification.requestPermission((permission) => handlePermission(permission, callback));
}