File tree Expand file tree Collapse file tree 1 file changed +7
-7
lines changed Expand file tree Collapse file tree 1 file changed +7
-7
lines changed Original file line number Diff line number Diff line change @@ -51,13 +51,6 @@ export default Base.extend({
5151
5252 async desktop_notification ( ) {
5353 try {
54- const response = await fetch ( this . options . url ) ;
55- const data = await response . json ( ) ;
56-
57- if ( data . length === 0 ) {
58- return ;
59- }
60-
6154 // Let's check if the browser supports notifications
6255 if ( ! ( "Notification" in window ) ) {
6356 logger . error ( "This browser does not support notifications." ) ;
@@ -79,6 +72,13 @@ export default Base.extend({
7972
8073 // Let's check if the user is okay to get some notification
8174 if ( Notification . permission === "granted" ) {
75+ const response = await fetch ( this . options . url ) ;
76+ const data = await response . json ( ) ;
77+
78+ if ( data . length === 0 ) {
79+ return ;
80+ }
81+
8282 for ( const message of data ) {
8383 new Notification ( message . title , message ) ;
8484 }
You can’t perform that action at this time.
0 commit comments