This commit is contained in:
j3d1 2024-01-31 22:51:01 +01:00
parent 2af52c6991
commit fbbc72feab
4 changed files with 67 additions and 5 deletions

View file

@ -88,6 +88,64 @@ export default (config) => {
}
/** may only be called from worker */
const clone = (obj) => {
if (isProxy(obj)) {
obj = toRaw(obj);
}
if (obj === null || typeof obj !== 'object') {
return obj;
}
if (obj.__proto__ === ({}).__proto__) {
return Object.assign({}, obj);
}
if (obj.__proto__ === [].__proto__) {
return obj.slice();
}
return obj;
}
const deepEqual = (a, b) => {
if (a === b) {
return true;
}
if (a === null || b === null) {
return false;
}
if (a.__proto__ === ({}).__proto__ && b.__proto__ === ({}).__proto__) {
if (Object.keys(a).length !== Object.keys(b).length) {
return false;
}
for (let key in b) {
if (!(key in a)) {
return false;
}
}
for (let key in a) {
if (!(key in b)) {
return false;
}
if (!deepEqual(a[key], b[key])) {
return false;
}
}
return true;
}
if (a.__proto__ === [].__proto__ && b.__proto__ === [].__proto__) {
if (a.length !== b.length) {
return false;
}
for (let i = 0; i < a.length; i++) {
if (!deepEqual(a[i], b[i])) {
return false;
}
}
return true;
}
return false;
}
const worker_fun = function (self, ctx) {
/* globals WebSocket, SharedWorker, onconnect, onmessage, postMessage, close, location */

View file

@ -140,7 +140,6 @@ const store = createStore({
updateTicket(state, updatedTicket) {
const ticket = state.tickets.filter(({id}) => id === updatedTicket.id)[0];
Object.assign(ticket, updatedTicket);
//triggerRef(state.tickets);
state.tickets = [...state.tickets];
},
replaceUsers(state, users) {
@ -199,6 +198,9 @@ const store = createStore({
setThumbnail(state, {url, data}) {
state.thumbnailCache[url] = data;
},
setThumbnail(state, {url, data}) {
state.thumbnailCache[url] = data;
},
},
actions: {
async login({commit}, {username, password, remember}) {
@ -428,7 +430,7 @@ const store = createStore({
]
}),
sharedStatePlugin({
debug: true,
debug: false,
isLoadedKey: "shared_loaded",
clearingMutation: "logout",
afterInit: "afterSharedInit",

View file

@ -47,7 +47,7 @@ const http = {
method: 'POST',
headers: {
"Content-Type": "application/json",
"Authorization": `Token ${token}`,
"Authorization": `Token ${data.token}`,
},
body: JSON.stringify(data),
});

View file

@ -23,13 +23,15 @@
>
<template #actions="{ item }">
<div class="btn-group">
<button class="btn btn-success" @click.stop="confirm('return Item?') && markItemReturned(item)" title="returned">
<button class="btn btn-success"
@click.stop="confirm('return Item?') && markItemReturned(item)" title="returned">
<font-awesome-icon icon="check"/>
</button>
<button class="btn btn-secondary" @click.stop="openEditingModalWith(item)" title="edit">
<font-awesome-icon icon="edit"/>
</button>
<button class="btn btn-danger" @click.stop="confirm('delete Item?') && deleteItem(item)" title="delete">
<button class="btn btn-danger" @click.stop="confirm('delete Item?') && deleteItem(item)"
title="delete">
<font-awesome-icon icon="trash"/>
</button>
</div>