Skip to content

Commit

Permalink
fix index + notifications
Browse files Browse the repository at this point in the history
  • Loading branch information
oFem1m committed May 25, 2024
1 parent 8e8fd28 commit afb99d7
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 29 deletions.
13 changes: 0 additions & 13 deletions src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,21 +16,8 @@
<script src="https://cdnjs.cloudflare.com/ajax/libs/handlebars.js/4.7.8/handlebars.min.js"
integrity="sha512-E1dSFxg+wsfJ4HKjutk/WaCzK7S2wv1POn1RRPGh8ZK+ag9l244Vqxji3r6wgz9YBf6+vhQEYJZpSjqWFPg9gg=="
crossorigin="anonymous" referrerpolicy="no-referrer"></script>
<script src="./Components/Form/Form.precompiled.js"></script>
<script src="./Components/Chat/Chat.precompiled.js"></script>
<script src="./Components/Contacts/Contacts.precompiled.js"></script>
<script src="./Components/ChatList/ChatList.precompiled.js"></script>
<script src="./Components/ContactItem/ContactItem.precompiled.js"></script>
<script src="./Components/ChatListItem/ChatListItem.precompiled.js"></script>
<script src="./Components/Message/Message.precompiled.js"></script>
<script src="./Components/Profile/Profile.precompiled.js"></script>
<script src="./Components/Search/Search.precompiled.js"></script>
<script src="./Components/ChatInput/ChatInput.precompiled.js"></script>
<script src="./index.js" type="module"></script>
<script src="./utils/router.js" type="module"></script>
<script type="text/javascript" src="https://www.gstatic.com/firebasejs/3.6.8/firebase.js"></script>
<script type="module" src="./utils/notifications.js"></script>

</body>

</html>
27 changes: 12 additions & 15 deletions src/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
import { AuthAPI } from './utils/API/AuthAPI.js';
// import { NotificationsManager } from './utils/notifications.js';
import './Components/Form/Form.precompiled.js';
import './Components/Chat/Chat.precompiled.js';
import './Components/Contacts/Contacts.precompiled.js';
import './Components/ChatList/ChatList.precompiled.js';
import './Components/ContactItem/ContactItem.precompiled.js';
import './Components/ChatListItem/ChatListItem.precompiled.js';
import './Components/Message/Message.precompiled.js';
import './Components/Profile/Profile.precompiled.js';
import './Components/Search/Search.precompiled.js';
import './Components/ChatInput/ChatInput.precompiled.js';
import './utils/router.js';
import './utils/notifications.js';

function registerServiceWorker() {
if ('serviceWorker' in navigator) {
Expand All @@ -25,17 +36,6 @@ function registerServiceWorker() {
);
});
}
// navigator.serviceWorker
// .register(new URL('./firebase-messaging-sw.js', import.meta.url))
// .then(function (registration) {
// console.log(
// 'Registration successful, scope is:',
// registration.scope,
// );
// })
// .catch(function (err) {
// console.log('Service worker registration failed, error:', err);
// });
}

window.addEventListener('load', function () {
Expand Down Expand Up @@ -63,6 +63,3 @@ Handlebars.registerHelper('ifEquals', function (arg1, arg2, options) {
Handlebars.registerHelper('ifNotEquals', function (arg1, arg2, options) {
return arg1 !== arg2 ? options.fn(this) : options.inverse(this);
});

// const notificationsManager = new NotificationsManager();
// notificationsManager.permissionCheck().then((result) => console.log(result));
2 changes: 1 addition & 1 deletion src/utils/notifications.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ function sendTokenToServer(currentToken) {
console.log('Отправка токена на сервер...');

const firebaseApi = new FirebaseAPI();
firebaseApi.setToken(currentToken).then();
firebaseApi.setToken(currentToken);

setTokenSentToServer(currentToken);
} else {
Expand Down

0 comments on commit afb99d7

Please sign in to comment.