Better url handling when connecting to socketio.
This commit is contained in:
@@ -87,13 +87,15 @@ export default {
|
|||||||
};
|
};
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
getChatHistory(0, 100).then(messages => (this.chatHistory = messages));
|
getChatHistory(0, this.historyPageSize)
|
||||||
|
.then(messages => this.chatHistory = messages);
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
this.track();
|
this.track();
|
||||||
this.getAttendees();
|
this.getAttendees();
|
||||||
this.getWinners();
|
this.getWinners();
|
||||||
this.socket = io(`${window.location.hostname}:${window.location.port}`);
|
const BASE_URL = __APIURL__ || window.location.origin;
|
||||||
|
this.socket = io(`${BASE_URL}`);
|
||||||
this.socket.on("color_winner", msg => {});
|
this.socket.on("color_winner", msg => {});
|
||||||
|
|
||||||
this.socket.on("chat", msg => {
|
this.socket.on("chat", msg => {
|
||||||
@@ -167,10 +169,11 @@ export default {
|
|||||||
const { historyPage, historyPageSize } = this;
|
const { historyPage, historyPageSize } = this;
|
||||||
const page = historyPage + 1;
|
const page = historyPage + 1;
|
||||||
|
|
||||||
getChatHistory(page * historyPageSize, historyPageSize).then(messages => {
|
getChatHistory(page * historyPageSize, historyPageSize)
|
||||||
this.chatHistory = messages.concat(this.chatHistory);
|
.then(messages => {
|
||||||
this.historyPage = page;
|
this.chatHistory = messages.concat(this.chatHistory);
|
||||||
});
|
this.historyPage = page;
|
||||||
|
});
|
||||||
},
|
},
|
||||||
getWinners: async function() {
|
getWinners: async function() {
|
||||||
let response = await winners();
|
let response = await winners();
|
||||||
|
|||||||
Reference in New Issue
Block a user