Skip to content

A self-hosted media server and file management system

dashboard event works but not the other

aminnausin148b8e5bd349
diff --git a/resources/js/layouts/LayoutBase.vue b/resources/js/layouts/LayoutBase.vue
index 88b42b61..c79a1dde 100755
--- a/resources/js/layouts/LayoutBase.vue
+++ b/resources/js/layouts/LayoutBase.vue
@@ -17,26 +17,32 @@ const userInit = ref(false);
onMounted(() => {
window.Echo.channel(`dashboard`).listen('TaskEnded', (event: any) => {
- console.log(event);
+ console.log(event, 'dash');
// toast('Hi2');
});
});
+function handleEvent() {
+ // @ts-ignore
+ if (!userData.value?.id || userInit.value) return;
+ userInit.value = true;
+ // @ts-ignore
+ console.log('window.echo', `tasks.${userData.value.id}`);
+ toast('hi');
+ // @ts-ignore
+ window.Echo.private(`tasks.${userData.value.id}`).listen('TaskEnded', (event: any) => {
+ console.log('window.echo2');
+ console.log(event);
+
+ toast('Hi');
+ });
+}
+
watch(
() => userData.value,
() => {
- // @ts-ignore
- if (!userData.value?.id || userInit.value) return;
- userInit.value = true;
- // console.log('window.echo', `tasks.${userData.value.id}`);
- // @ts-ignore
- window.Echo.private(`tasks.${userData.value.id}`).listen('TaskEnded', (event: any) => {
- console.log('window.echo2');
- console.log(event);
-
- toast('Hi');
- });
+ handleEvent();
},
);
</script>