Skip to content

Commit 946fe7a

Browse files
Binx98liuruibin
authored andcommitted
fix: fix redirect to read page url error
1 parent 698ee5b commit 946fe7a

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,18 @@
11
import { defineStore } from 'pinia'
22
const useApplicationStore = defineStore('application', {
33
state: () => ({
4-
location: `${window.location.origin}${window.MaxKB.chatPrefix ? window.MaxKB.chatPrefix : window.MaxKB.prefix}/`,
4+
location: `${getChatOrigin()}${
5+
window.MaxKB.chatPrefix ? window.MaxKB.chatPrefix : window.MaxKB.prefix
6+
}/`,
57
}),
68
actions: {},
79
})
810

11+
function getChatOrigin() {
12+
if (import.meta.env.DEV && window.location.port === '3000') {
13+
return `${window.location.protocol}//${window.location.hostname}:3001`
14+
}
15+
return window.location.origin
16+
}
17+
918
export default useApplicationStore

0 commit comments

Comments
 (0)