Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: Matthew Nickson <mnickson@sidingsmedia.com>
  • Loading branch information
chakflying and Computroniks committed Aug 16, 2023
1 parent 7de4cee commit b096586
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/components/settings/Notifications.vue
Original file line number Diff line number Diff line change
Expand Up @@ -114,13 +114,13 @@ export default {
watch: {
// Parse, store and apply new timeout settings.
toastSuccessTimeoutSecs: function (newTimeout) {
toastSuccessTimeoutSecs(newTimeout) {
const parsedTimeout = parseInt(newTimeout);
if (parsedTimeout != null && !Number.isNaN(parsedTimeout)) {
localStorage.toastSuccessTimeout = newTimeout > 0 ? newTimeout * 1000 : newTimeout;
}
},
toastErrorTimeoutSecs: function (newTimeout) {
toastErrorTimeoutSecs(newTimeout) {
const parsedTimeout = parseInt(newTimeout);
if (parsedTimeout != null && !Number.isNaN(parsedTimeout)) {
localStorage.toastErrorTimeout = newTimeout > 0 ? newTimeout * 1000 : newTimeout;
Expand Down
10 changes: 9 additions & 1 deletion src/util-frontend.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import dayjs from "dayjs";
import timezones from "timezones-list";
import { localeDirection, currentLocale } from "./i18n";
import { TYPE, POSITION } from "vue-toastification";
import { POSITION } from "vue-toastification";

/**
* Returns the offset from UTC in hours for the current locale.
Expand Down Expand Up @@ -172,6 +172,10 @@ export function loadToastSettings() {
};
}

/**
* Get timeout for success toasts
* @returns {(number|boolean)} Timeout in ms. If false timeout disabled.
*/
export function getToastSuccessTimeout() {
let successTimeout = 20000;

Expand All @@ -189,6 +193,10 @@ export function getToastSuccessTimeout() {
return successTimeout;
}

/**
* Get timeout for error toasts
* @returns {(number|boolean)} Timeout in ms. If false timeout disabled.
*/
export function getToastErrorTimeout() {
let errorTimeout = -1;

Expand Down

0 comments on commit b096586

Please sign in to comment.