mirror of
https://github.com/jxxghp/MoviePilot-Frontend.git
synced 2026-09-05 23:56:42 +08:00
rollback sse
This commit is contained in:
-22
@@ -1,27 +1,5 @@
|
|||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { useToast } from "vue-toast-notification";
|
|
||||||
import store from "./store";
|
|
||||||
|
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
const $toast = useToast();
|
|
||||||
|
|
||||||
onMounted(() => {
|
|
||||||
const token = store.state.auth.token;
|
|
||||||
if (token) {
|
|
||||||
const eventSource = new EventSource(
|
|
||||||
`${import.meta.env.VITE_API_BASE_URL}system/message?token=${token}`
|
|
||||||
);
|
|
||||||
|
|
||||||
eventSource.addEventListener("message", (event) => {
|
|
||||||
const message = event.data;
|
|
||||||
$toast.info(message);
|
|
||||||
});
|
|
||||||
|
|
||||||
onBeforeUnmount(() => {
|
|
||||||
eventSource.close();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
|||||||
Reference in New Issue
Block a user