修改订阅问题

This commit is contained in:
ival 2019-11-19 10:08:57 +08:00
parent 307081aee4
commit fb71e4cbe8
2 changed files with 7 additions and 3 deletions

View File

@ -7,7 +7,6 @@
<script> <script>
import { getToken } from '@/utils/auth'; import { getToken } from '@/utils/auth';
import { creatSubscribe, perpetualTopic, commonTopic } from '@/utils/stomp';
import { getSessionStorage } from '@/utils/auth'; import { getSessionStorage } from '@/utils/auth';
import { ProjectIcon, loginInfo } from '@/scripts/ConstDic'; import { ProjectIcon, loginInfo } from '@/scripts/ConstDic';
import DeomonTopic from '@/views/demonstration/deomonTopic'; import DeomonTopic from '@/views/demonstration/deomonTopic';
@ -81,8 +80,7 @@ export default {
const token = getToken(); const token = getToken();
if (token && this.$route.path != '/404') { if (token && this.$route.path != '/404') {
const header = { group: '', 'X-Token': token }; const header = { group: '', 'X-Token': token };
creatSubscribe(perpetualTopic, header); this.$store.dispatch('subscribe', {header, type: getSessionStorage('project')});
creatSubscribe(commonTopic, header);
} }
}); });
} }

View File

@ -167,6 +167,12 @@ const user = {
SetAccount({ commit }, account) { SetAccount({ commit }, account) {
commit('SET_ACCOUNT', account); commit('SET_ACCOUNT', account);
},
subscribe({commit}, params) {
commit('SUBSCRIBE', params);
},
subscribe_un({commit}, params) {
commit('SUBSCRIBE_UN', params);
} }
} }
}; };