Skip to content

Commit d6284bf

Browse files
committed
feat: enhance error handling for utils.js
1 parent df5d2ca commit d6284bf

File tree

1 file changed

+5
-15
lines changed

1 file changed

+5
-15
lines changed

web/default/src/helpers/utils.js

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
import { toast } from 'react-toastify';
2-
import { toastConstants } from '../constants';
1+
import {toast} from 'react-toastify';
2+
import {toastConstants} from '../constants';
33
import React from 'react';
4-
import { API } from './api';
4+
import {API} from './api';
55

66
const HTMLToastContent = ({ htmlContent }) => {
77
return <div dangerouslySetInnerHTML={{ __html: htmlContent }} />;
@@ -74,6 +74,7 @@ if (isMobile()) {
7474
}
7575

7676
export function showError(error) {
77+
if (!error) return;
7778
console.error(error);
7879
if (error.message) {
7980
if (error.name === 'AxiosError') {
@@ -158,17 +159,7 @@ export function timestamp2string(timestamp) {
158159
second = '0' + second;
159160
}
160161
return (
161-
year +
162-
'-' +
163-
month +
164-
'-' +
165-
day +
166-
' ' +
167-
hour +
168-
':' +
169-
minute +
170-
':' +
171-
second
162+
year + '-' + month + '-' + day + ' ' + hour + ':' + minute + ':' + second
172163
);
173164
}
174165

@@ -193,7 +184,6 @@ export const verifyJSON = (str) => {
193184
export function shouldShowPrompt(id) {
194185
let prompt = localStorage.getItem(`prompt-${id}`);
195186
return !prompt;
196-
197187
}
198188

199189
export function setPromptShown(id) {

0 commit comments

Comments
 (0)