mirror of
https://github.com/yawaflua/LuckyDiamond.git
synced 2025-12-10 04:09:29 +02:00
added logic for setvalue timer in crash
This commit is contained in:
@@ -1,66 +1,70 @@
|
|||||||
// import { BackendWebSocketUrl } from '@/properties/Сonfig.js';
|
import { BackendWebSocketUrl } from '@/properties/Сonfig.js';
|
||||||
// import { eventBus } from "@/main";
|
import { eventBus } from "@/main";
|
||||||
// import {
|
import {
|
||||||
// GetCookie
|
GetCookie
|
||||||
// } from "@/assets/js/storage/CookieStorage.js";
|
} from "@/assets/js/storage/CookieStorage.js";
|
||||||
//
|
|
||||||
// let webSocket;
|
let webSocket;
|
||||||
//
|
|
||||||
// export function ConnectToChat() {
|
export function ConnectToChat() {
|
||||||
// try {
|
try {
|
||||||
// webSocket = new WebSocket(BackendWebSocketUrl);
|
webSocket = new WebSocket(BackendWebSocketUrl);
|
||||||
//
|
|
||||||
// webSocket.onopen = function () {
|
webSocket.onopen = function () {
|
||||||
// console.log('Connection established');
|
console.log('Connection established');
|
||||||
// };
|
};
|
||||||
//
|
|
||||||
// webSocket.onmessage = function (event) {
|
webSocket.onmessage = function (event) {
|
||||||
//
|
|
||||||
// const dataObject = JSON.parse(event.data);
|
const dataObject = JSON.parse(event.data);
|
||||||
//
|
|
||||||
// if (dataObject && Object.prototype.hasOwnProperty.call(dataObject, 'SpUserName') && Object.prototype.hasOwnProperty.call(dataObject, 'Message')) {
|
if (dataObject && Object.prototype.hasOwnProperty.call(dataObject, 'SpUserName') && Object.prototype.hasOwnProperty.call(dataObject, 'Message')) {
|
||||||
// eventBus.emit('dataChat', event.data);
|
eventBus.emit('dataChat', event.data);
|
||||||
// }
|
console.log('CHAT')
|
||||||
//
|
}
|
||||||
// console.log('Message from Server:', event.data);
|
else {
|
||||||
// };
|
eventBus.emit('crash', event.data)
|
||||||
//
|
}
|
||||||
// webSocket.onclose = function () {
|
|
||||||
//
|
// console.log('Message from Server:', event.data);
|
||||||
// webSocket = new WebSocket(BackendWebSocketUrl);
|
};
|
||||||
//
|
|
||||||
// console.log('Connection closed and reconnected');
|
webSocket.onclose = function () {
|
||||||
// };
|
|
||||||
//
|
webSocket = new WebSocket(BackendWebSocketUrl);
|
||||||
// webSocket.onerror = function (event) {
|
|
||||||
// console.error('WebSocket Error:', event);
|
console.log('Connection closed and reconnected');
|
||||||
// };
|
};
|
||||||
// } catch (error) {
|
|
||||||
// console.error('Error in ConnectToChat:', error);
|
webSocket.onerror = function (event) {
|
||||||
// }
|
console.error('WebSocket Error:', event);
|
||||||
// }
|
};
|
||||||
//
|
} catch (error) {
|
||||||
// export function SendMessageToChat(message) {
|
console.error('Error in ConnectToChat:', error);
|
||||||
// try {
|
}
|
||||||
//
|
}
|
||||||
// if (!GetCookie("SpUserName") && !GetCookie("AUTHTOKEN") && !GetCookie("SearchToken")) {
|
|
||||||
// return;
|
export function SendMessageToChat(message) {
|
||||||
// }
|
try {
|
||||||
//
|
|
||||||
// const userCredentials = {
|
if (!GetCookie("SpUserName") && !GetCookie("AUTHTOKEN") && !GetCookie("SearchToken")) {
|
||||||
// SearchToken: GetCookie("SearchToken"),
|
return;
|
||||||
// AUTHTOKEN: GetCookie("AUTHTOKEN")
|
}
|
||||||
// };
|
|
||||||
//
|
const userCredentials = {
|
||||||
// const messageObject = {
|
SearchToken: GetCookie("SearchToken"),
|
||||||
// UserCredentials: userCredentials,
|
AUTHTOKEN: GetCookie("AUTHTOKEN")
|
||||||
// Message: message,
|
};
|
||||||
// MessageType: "Chat"
|
|
||||||
// };
|
const messageObject = {
|
||||||
//
|
UserCredentials: userCredentials,
|
||||||
// webSocket.send(JSON.stringify(messageObject));
|
Message: message,
|
||||||
//
|
MessageType: "Chat"
|
||||||
// } catch (error) {
|
};
|
||||||
// console.error('Error in ConnectToChat:', error);
|
|
||||||
// }
|
webSocket.send(JSON.stringify(messageObject));
|
||||||
// }
|
|
||||||
|
} catch (error) {
|
||||||
|
console.error('Error in ConnectToChat:', error);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -74,6 +74,7 @@ import '@/assets/css/PagesStyles/games-pages/crash.css'
|
|||||||
import SaperNumbers from "@/mocks/SaperNumbers";
|
import SaperNumbers from "@/mocks/SaperNumbers";
|
||||||
import {GetCurrentMoney} from "@/assets/js/rest/RestMethods";
|
import {GetCurrentMoney} from "@/assets/js/rest/RestMethods";
|
||||||
import {GetCookie} from "@/assets/js/storage/CookieStorage";
|
import {GetCookie} from "@/assets/js/storage/CookieStorage";
|
||||||
|
import {eventBus} from "@/main";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: { HeaderComponent, AsideBarComponent, ChatComponent, CrashGraphComponent },
|
components: { HeaderComponent, AsideBarComponent, ChatComponent, CrashGraphComponent },
|
||||||
@@ -81,12 +82,26 @@ export default {
|
|||||||
return {
|
return {
|
||||||
SaperNumbers,
|
SaperNumbers,
|
||||||
amountDeposit: 0,
|
amountDeposit: 0,
|
||||||
autoRatio: 0
|
autoRatio: 0,
|
||||||
|
timerGame: ''
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
setup() {
|
setup() {
|
||||||
return { v$: useVuelidate() }
|
return { v$: useVuelidate() }
|
||||||
},
|
},
|
||||||
|
mounted() {
|
||||||
|
eventBus.on('crash', (dataCrash) => {
|
||||||
|
try {
|
||||||
|
const dataCrashParse = JSON.parse(dataCrash)
|
||||||
|
|
||||||
|
this.timerGame = dataCrashParse.WaitingTime
|
||||||
|
console.log(this.timerGame)
|
||||||
|
}
|
||||||
|
catch (e) {
|
||||||
|
console.error(e)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
validations() {
|
validations() {
|
||||||
return {
|
return {
|
||||||
amountDeposit: { required, numeric, minValue: minValue(1), maxValue: maxValue(100), integer },
|
amountDeposit: { required, numeric, minValue: minValue(1), maxValue: maxValue(100), integer },
|
||||||
|
|||||||
Reference in New Issue
Block a user