Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
this.unsubscribe = watch(dashboardPath, (w, error) => {
if (error) {
Toast.create({
children:
"Error occurred while loading dashboard: " + error.toString(),
timeout: 10000,
mod: "error"
}).open();
console.log(error);
History.pushState({}, null, "~/");
} else {
this.store.set("$page.dashboard", {
width: 80,
height: 40,
...w
});
if (!isNonEmptyArray(w.widgets)) {
if (this.store.set('$page.add', true)) {
Toast.create({
children: 'Drag & drop widgets from the right sidebar on the board.',
timeout: 5000,
mod: "primary"
}).open();
}
}
}
deleteUser(userId).then(() => {
History.pushState({}, null, "~/users");
});
}
boardTracker = new UserBoardTracker(userId, () => {
let boards = boardTracker.getActiveBoards();
this.store.set("boards", boards);
set("boards", boards);
if (!isNonEmptyArray(boards)) {
History.pushState({}, null, "~/new");
}
else if (get("url") == "~/")
History.pushState({}, null, "~/b/" + boards[0].id);
});
this.addTrigger("userLogged", ["user.id"], userId => {
if (!userId)
return
History.pushState({}, null, "~/")
})
}
onDeleteBoard(e, { store }) {
let board = store.get("$board");
boardTracker.update(board.id, {
deleted: true,
deletedDate: new Date().toISOString(),
edit: false
}, { suppressUpdate: true });
boardTracker.reorder(true);
boardTracker.forceUpdate();
let boards = boardTracker.getActiveBoards();
History.pushState({}, null, boards.length > 0 ? "~/b/" + boards[0].id : "~/")
Toast.create({
mod: 'warning',
timeout: 3000,
items: (
<div>
</div>
)
}).open();
},
let u2 = registerKeyboardShortcut({ keyCode: 191 }, (e) => {
if (e.target.tagName === "INPUT" || e.target.tagName === "TEXTAREA")
return;
e.preventDefault();
e.stopPropagation();
if (!e.shiftKey) {
let searchEl = document.getElementById("search");
FocusManager.focusFirst(searchEl);
}
else {
History.pushState({}, null, "~/help");
}
});
let u4 = registerKeyboardShortcut({ keyCode: 221, ctrlKey: true }, (e) => {
e.preventDefault();
let { boards, $route } = store.getData();
let boardInd = boards.findIndex(a => a.id == $route.boardId);
if (boardInd + 1 >= boards.length) return;
let nextBoard = boards[boardInd + 1];
History.pushState({}, null, `~/b/${nextBoard.id}`);
});
export default store => next => action => {
switch (action.type) {
case GOTO_BOARD:
History.pushState({}, null, `~/b/${action.id}`);
return;
case GOTO_ANY_BOARD:
if (action.forced || (window.location.hash || '#') == '#') {
const {tdo} = store.getState();
if (tdo.boards.length > 0)
History.pushState({}, null, `~/b/${tdo.boards[0].id}`);
}
return;
default:
return next(action);
}
};
boardTracker = new UserBoardTracker(userId, () => {
let boards = boardTracker.getActiveBoards();
this.store.set("boards", boards);
set("boards", boards);
if (!isNonEmptyArray(boards)) {
History.pushState({}, null, "~/new");
}
else if (get("url") == "~/")
History.pushState({}, null, "~/b/" + boards[0].id);
});