diff --git a/src/app.js b/src/app.js index d8c4712..3e921ce 100644 --- a/src/app.js +++ b/src/app.js @@ -158,14 +158,6 @@ function setClientModeKeyBindings() { } }) } - -/* ===== Socketio listeners ===== */ - -// Debug messages for socketio -socket.on('message', function (msg) { - console.log(msg) -}) - function loggedIn(data) { const { status, user } = data @@ -201,6 +193,12 @@ function loggedIn(data) { } } +/* ===== Socketio listeners ===== */ + +// Debug messages for socketio +socket.on('message', function (msg) { + console.log(msg) +}) socket.on('restoringQueue', function () { toast(i18n.t('toasts.restoringQueue'), 'loading', false, 'restoring_queue') }) @@ -256,3 +254,7 @@ socket.on('startGeneratingItems', function (data) { socket.on('finishGeneratingItems', function (data) { toast(i18n.t('toasts.finishGeneratingItems', { n: data.total }), 'done', true, 'batch_' + data.uuid) }) +socket.on('toast', data => { + const { msg, icon, dismiss, id } = data + toast(msg, icon || null, dismiss !== undefined ? dismiss : true, id || null) +}) diff --git a/src/utils/toasts.js b/src/utils/toasts.js index ea6e587..7eacf13 100644 --- a/src/utils/toasts.js +++ b/src/utils/toasts.js @@ -2,8 +2,6 @@ import Toastify from 'toastify-js' import 'toastify-js/src/toastify.css' import '@/styles/css/toasts.css' -import { socket } from '@/utils/socket' - const sharedOptions = { gravity: 'bottom', position: 'left' @@ -118,9 +116,3 @@ export const toast = function (msg, icon = null, dismiss = true, id = null) { } } } - -socket.on('toast', data => { - const { msg, icon, dismiss, id } = data - - toast(msg, icon || null, dismiss !== undefined ? dismiss : true, id || null) -})