diff --git a/resources/js/Pages/API/Partials/ApiTokenManager.vue b/resources/js/Pages/API/Partials/ApiTokenManager.vue index b373d142ced..0c61ee4feef 100644 --- a/resources/js/Pages/API/Partials/ApiTokenManager.vue +++ b/resources/js/Pages/API/Partials/ApiTokenManager.vue @@ -2,6 +2,7 @@ import { ref, watch } from 'vue'; import { useForm } from '@inertiajs/inertia-vue3'; import { trans } from 'laravel-vue-i18n'; +import { flash } from '@/methods.js'; import useClipboard from 'vue-clipboard3'; import JetActionMessage from '@/Components/Jetstream/ActionMessage.vue'; import JetActionSection from '@/Components/Jetstream/ActionSection.vue'; diff --git a/resources/js/methods.js b/resources/js/methods.js index b76dc3c9893..9bf243c0987 100644 --- a/resources/js/methods.js +++ b/resources/js/methods.js @@ -1,19 +1,18 @@ -import Emitter from 'tiny-emitter'; -const emitter = new Emitter(); +import emitter from 'tiny-emitter/instance'; -export default { - /** - * Flash a message. - * - * @param {string} message - * @param {string} level - */ - flash(message, level = 'success') { - this.$emitt('flash', { message, level }); - }, +/** + * Flash a message. + * + * @param {string} message + * @param {string} level + */ +export const flash = (message, level = 'success') => { + emitter.emit('flash', { message, level }); +}; +export default { + flash, $on: (...args) => emitter.on(...args), $once: (...args) => emitter.once(...args), $off: (...args) => emitter.off(...args), - $emitt: (...args) => emitter.emit(...args), };