feat: 整合 sse 推送

This commit is contained in:
xlsea
2024-09-02 09:34:34 +08:00
parent 6afd5cc36a
commit 89f5e8577e
15 changed files with 105 additions and 25 deletions

View File

@ -5,6 +5,7 @@ import type { LayoutMode } from '@sa/materials';
import { useAppStore } from '@/store/modules/app';
import { useThemeStore } from '@/store/modules/theme';
import { initWebSocket } from '@/utils/websocket';
import { initSSE } from '@/utils/sse';
import GlobalHeader from '../modules/global-header/index.vue';
import GlobalSider from '../modules/global-sider/index.vue';
import GlobalTab from '../modules/global-tab/index.vue';
@ -105,6 +106,7 @@ function getSiderCollapsedWidth() {
onMounted(() => {
const protocol = window.location.protocol === 'https:' ? 'wss://' : 'ws://';
initWebSocket(`${protocol + window.location.host + import.meta.env.VITE_APP_BASE_API}/resource/websocket`);
initSSE(`${import.meta.env.VITE_APP_BASE_API}/resource/sse`);
});
</script>

View File

@ -50,7 +50,7 @@ function logout() {
positiveText: $t('common.confirm'),
negativeText: $t('common.cancel'),
onPositiveClick: () => {
authStore.resetStore();
authStore.logout();
}
});
}