feat: updates to things

main
Ayush Mukherjee 1 year ago
parent e55b6e949e
commit 68c909a1aa

@ -12,7 +12,7 @@
"postinstall": "electron-builder install-app-deps", "postinstall": "electron-builder install-app-deps",
"postuninstall": "electron-builder install-app-deps" "postuninstall": "electron-builder install-app-deps"
}, },
"main": "background.js", "main": "src/background.js",
"dependencies": { "dependencies": {
"@vue/devtools": "^6.0.0-beta.6", "@vue/devtools": "^6.0.0-beta.6",
"autoprefixer": "^10", "autoprefixer": "^10",

@ -4,7 +4,9 @@ import { handleMsg, sendSub } from './utils/websocket'
const token = window.localStorage.getItem('token') const token = window.localStorage.getItem('token')
const server = 'nuke.aplesports.com:5000' const server = process.env.VUE_APP_NUKE_URI
const api_proto = process.env.VUE_APP_NUKE_API_PROTO
const ws_proto = process.env.VUE_APP_NUKE_WS_PROTO
const state = reactive({ const state = reactive({
name: '', name: '',
@ -30,7 +32,7 @@ const methods = {
authenticate: async (token) => { authenticate: async (token) => {
state.session = null state.session = null
window.localStorage.setItem('token', token) window.localStorage.setItem('token', token)
return axios.post(`http://${server}/api/v1`, { return axios.post(`${api_proto}://${server}/api/v1`, {
token, token,
}) })
.then((res) => { .then((res) => {
@ -42,7 +44,7 @@ const methods = {
}, },
connect: () => { connect: () => {
if (state.session !== null) { if (state.session !== null) {
state.ws = new WebSocket(`ws://${server}/ws/${state.session}`) state.ws = new WebSocket(`${ws_proto}://${server}/ws/${state.session}`)
state.ws.onopen = () => { state.ws.onopen = () => {
clearInterval(interval) clearInterval(interval)
sendSub(state.ws) sendSub(state.ws)

Loading…
Cancel
Save