chore: sse配置文件关闭
This commit is contained in:
@@ -21,5 +21,5 @@ VITE_GLOB_RSA_PRIVATE_KEY=MIIBVAIBADANBgkqhkiG9w0BAQEFAASCAT4wggE6AgEAAkEAmc3CuP
|
||||
# 客户端id
|
||||
VITE_GLOB_APP_CLIENT_ID=e5cd7e4891bf95d1d19206ce24a7b32e
|
||||
|
||||
# 开启WEBSOCKET
|
||||
VITE_GLOB_WEBSOCKET_ENABLE=false
|
||||
# 开启SSE
|
||||
VITE_GLOB_SSE_ENABLE=true
|
||||
|
@@ -27,6 +27,6 @@ VITE_GLOB_RSA_PRIVATE_KEY=MIIBVAIBADANBgkqhkiG9w0BAQEFAASCAT4wggE6AgEAAkEAmc3CuP
|
||||
# 客户端id
|
||||
VITE_GLOB_APP_CLIENT_ID=e5cd7e4891bf95d1d19206ce24a7b32e
|
||||
|
||||
# 开启WEBSOCKET
|
||||
VITE_GLOB_WEBSOCKET_ENABLE=false
|
||||
# 开启SSE
|
||||
VITE_GLOB_SSE_ENABLE=true
|
||||
|
||||
|
@@ -4,7 +4,10 @@ import { useAppConfig } from '@vben/hooks';
|
||||
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
const { clientId } = useAppConfig(import.meta.env, import.meta.env.PROD);
|
||||
const { clientId, sseEnable } = useAppConfig(
|
||||
import.meta.env,
|
||||
import.meta.env.PROD,
|
||||
);
|
||||
|
||||
export namespace AuthApi {
|
||||
/**
|
||||
@@ -96,6 +99,12 @@ export function doLogout() {
|
||||
* @returns void
|
||||
*/
|
||||
export function seeConnectionClose() {
|
||||
/**
|
||||
* 未开启sse 不需要处理
|
||||
*/
|
||||
if (!sseEnable) {
|
||||
return;
|
||||
}
|
||||
return requestClient.get<void>('/resource/sse/close');
|
||||
}
|
||||
|
||||
|
@@ -12,7 +12,7 @@ import { notification } from 'ant-design-vue';
|
||||
import dayjs from 'dayjs';
|
||||
import { defineStore } from 'pinia';
|
||||
|
||||
const { apiURL, clientId } = useAppConfig(
|
||||
const { apiURL, clientId, sseEnable } = useAppConfig(
|
||||
import.meta.env,
|
||||
import.meta.env.PROD,
|
||||
);
|
||||
@@ -40,6 +40,12 @@ export const useNotifyStore = defineStore(
|
||||
* 开始监听sse消息
|
||||
*/
|
||||
function startListeningMessage() {
|
||||
/**
|
||||
* 未开启 不监听
|
||||
*/
|
||||
if (!sseEnable) {
|
||||
return;
|
||||
}
|
||||
const accessStore = useAccessStore();
|
||||
const token = accessStore.accessToken;
|
||||
|
||||
|
Reference in New Issue
Block a user