This commit is contained in:
j3d1 2023-12-11 23:24:47 +01:00
parent d853d0dcb2
commit 7fcf04741e
3 changed files with 8 additions and 4 deletions

View file

@ -44,9 +44,9 @@ library.add(faPlus, faCheckCircle, faEdit, faTrash, faCat, faSyncAlt, faSort, fa
faWindowClose, faCamera, faStop, faPen, faCheck, faTimes, faSave, faEye, faComment, faUser, faComments, faEnvelope);
Vue.component('font-awesome-icon', FontAwesomeIcon);
import VueQRCodeComponent from 'vue-qrcode-component'
//import VueQRCodeComponent from 'vue-qrcode-component'
Vue.component('qr-code', VueQRCodeComponent)
//Vue.component('qr-code', VueQRCodeComponent)
sync(store, router);

View file

@ -127,6 +127,10 @@ const store = new Vuex.Store({
state.user = user;
localStorage.setItem('user', user);
},
setToken(state, token) {
state.token = token;
localStorage.setItem('token', token);
},
logout(state) {
state.user = null;
state.token = null;
@ -145,7 +149,7 @@ const store = new Vuex.Store({
body: JSON.stringify({username: username, password: password}),
credentials: 'omit'
}).then(r => r.json())
if (data.token && data.key) {
if (data.token) {
commit('setToken', data.token);
commit('setUser', username);
axios.defaults.headers.common['Authorization'] = `Token ${data.token}`;

View file

@ -2,7 +2,7 @@
<div class="container-fluid px-xl-5 mt-3">
<div class="row">
<div class="col-xl-8 offset-xl-2">
<qr-code :text="qr_url" color="#000" bg-color="#fff" error-level="H" class="qr-code"></qr-code>
<!--qr-code :text="qr_url" color="#000" bg-color="#fff" error-level="H" class="qr-code"></qr-code-->
<h3 class="text-center">Events</h3>
<!--p>{{ events }}</p-->
<ul>