fix lints (#8737)
* fix: emits use ev instead of e * fix: errors use err instead of e * fix: replace use of data where possible * fix: events use evt instead of e * fix: use strict equals * fix: use emoji instead of e * fix: vue lints
This commit is contained in:
@ -14,30 +14,29 @@ export function swInject() {
|
||||
console.log('sw msg', ev.data);
|
||||
}
|
||||
|
||||
const data = ev.data; // as SwMessage
|
||||
if (data.type !== 'order') return;
|
||||
if (ev.data.type !== 'order') return;
|
||||
|
||||
if (data.loginId !== $i?.id) {
|
||||
return getAccountFromId(data.loginId).then(account => {
|
||||
if (ev.data.loginId !== $i?.id) {
|
||||
return getAccountFromId(ev.data.loginId).then(account => {
|
||||
if (!account) return;
|
||||
return login(account.token, data.url);
|
||||
return login(account.token, ev.data.url);
|
||||
});
|
||||
}
|
||||
|
||||
switch (data.order) {
|
||||
switch (ev.data.order) {
|
||||
case 'post':
|
||||
return post(data.options);
|
||||
return post(ev.data.options);
|
||||
case 'push':
|
||||
if (router.currentRoute.value.path === data.url) {
|
||||
if (router.currentRoute.value.path === ev.data.url) {
|
||||
return window.scroll({ top: 0, behavior: 'smooth' });
|
||||
}
|
||||
if (navHook) {
|
||||
return navHook(data.url);
|
||||
return navHook(ev.data.url);
|
||||
}
|
||||
if (sideViewHook && defaultStore.state.defaultSideView && data.url !== '/') {
|
||||
return sideViewHook(data.url);
|
||||
if (sideViewHook && defaultStore.state.defaultSideView && ev.data.url !== '/') {
|
||||
return sideViewHook(ev.data.url);
|
||||
}
|
||||
return router.push(data.url);
|
||||
return router.push(ev.data.url);
|
||||
default:
|
||||
return;
|
||||
}
|
||||
|
@ -44,13 +44,13 @@ export default defineComponent({
|
||||
},
|
||||
|
||||
removeWidget(widget) {
|
||||
this.$store.set('widgets', this.$store.state.widgets.filter(w => w.id != widget.id));
|
||||
this.$store.set('widgets', this.$store.state.widgets.filter(w => w.id !== widget.id));
|
||||
},
|
||||
|
||||
updateWidget({ id, data }) {
|
||||
this.$store.set('widgets', this.$store.state.widgets.map(w => w.id === id ? {
|
||||
...w,
|
||||
data: data
|
||||
data,
|
||||
} : w));
|
||||
},
|
||||
|
||||
|
@ -276,14 +276,14 @@ export function setColumnWidgets(id: Column['id'], widgets: ColumnWidget[]) {
|
||||
saveDeck();
|
||||
}
|
||||
|
||||
export function updateColumnWidget(id: Column['id'], widgetId: string, data: any) {
|
||||
export function updateColumnWidget(id: Column['id'], widgetId: string, WidgetData: any) {
|
||||
const columns = copy(deckStore.state.columns);
|
||||
const columnIndex = deckStore.state.columns.findIndex(c => c.id === id);
|
||||
const column = copy(deckStore.state.columns[columnIndex]);
|
||||
if (column == null) return;
|
||||
column.widgets = column.widgets.map(w => w.id === widgetId ? {
|
||||
...w,
|
||||
data: data
|
||||
data: widgetData,
|
||||
} : w);
|
||||
columns[columnIndex] = column;
|
||||
deckStore.set('columns', columns);
|
||||
|
@ -14,7 +14,7 @@ import { i18n } from '@/i18n';
|
||||
import { defaultStore } from '@/store';
|
||||
|
||||
const emit = defineEmits<{
|
||||
(e: 'mounted', el: Element): void;
|
||||
(ev: 'mounted', el: Element): void;
|
||||
}>();
|
||||
|
||||
let editMode = $ref(false);
|
||||
@ -32,13 +32,13 @@ function addWidget(widget) {
|
||||
}
|
||||
|
||||
function removeWidget(widget) {
|
||||
defaultStore.set('widgets', defaultStore.state.widgets.filter(w => w.id != widget.id));
|
||||
defaultStore.set('widgets', defaultStore.state.widgets.filter(w => w.id !== widget.id));
|
||||
}
|
||||
|
||||
function updateWidget({ id, data }) {
|
||||
defaultStore.set('widgets', defaultStore.state.widgets.map(w => w.id === id ? {
|
||||
...w,
|
||||
data: data
|
||||
data,
|
||||
} : w));
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user