added token to local storage

main
Ayush Mukherjee 4 years ago
parent d8ce30df85
commit 24b90f6293

@ -2,9 +2,11 @@ import { reactive, readonly } from 'vue'
import axios from 'axios'
import { handleMsg, sendSub } from './utils/websocket'
const token = localStorage.getItem('token')
const state = reactive({
name: '',
token: '',
token: token || '',
session: '',
loggedIn: false,
ws: null,
@ -21,7 +23,7 @@ const state = reactive({
const methods = {
authenticate: async (token) => {
console.log(token)
localStorage.setItem('token', token)
return axios.post('http://178.79.128.135:5000/api/v1', {
token,
})

@ -92,8 +92,6 @@ export default {
window.ipcRenderer.on('test', (e, msg) => {
const data = JSON.parse(msg)
// const games = m.hasOwnProperty('games') ? m.games.push(data.game) : [data.game]
update('matches', data.id, {
started: data.started,
done: data.done,

@ -1,6 +1,6 @@
<template>
<div class="bg-gray-200 w-screen h-screen mx-auto py-10 flex flex-col justify-center items-center">
<h1 class="text-2xl uppercase text-red-600 font-black text-center">APL Slapdash</h1>
<h1 class="text-2xl uppercase text-red-500 font-black text-center">Slapdash</h1>
<h2 class="my-4 text-lg">Welcome to Slapdash!</h2>
<p class="my-8">Please enter your token to continue</p>
<div class="input w-96 flex flex-col justify-center items-center">
@ -18,7 +18,7 @@ export default {
setup() {
const store = inject('store')
const disable = ref(false)
const token = ref('')
const token = ref(store.state.token)
const router = useRouter()
const doAuth = async () => {

Loading…
Cancel
Save