FE refactor
This commit is contained in:
1 parent
e5181727fe
commit
107540b2a8
5 files changed
+60
-37
No files matched your search
@@ -247,11 +247,14 @@ class NetworkService {
|
||||
if (config.dateRange) params.append("dateRange", config.dateRange);
|
||||
if (config.normalize) params.append("normalize", config.normalize);
|
||||
|
||||
return this.axiosInstance.get(`/monitors/uptime/details/${config.monitorId}`, {
|
||||
headers: {
|
||||
Authorization: `Bearer ${config.authToken}`,
|
||||
},
|
||||
});
|
||||
return this.axiosInstance.get(
|
||||
`/monitors/uptime/details/${config.monitorId}?${params.toString()}`,
|
||||
{
|
||||
headers: {
|
||||
Authorization: `Bearer ${config.authToken}`,
|
||||
},
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,8 +1,11 @@
|
||||
import dayjs from "dayjs";
|
||||
import utc from "dayjs/plugin/utc";
|
||||
import timezone from "dayjs/plugin/timezone";
|
||||
import customParseFormat from "dayjs/plugin/customParseFormat";
|
||||
|
||||
dayjs.extend(utc);
|
||||
dayjs.extend(timezone);
|
||||
dayjs.extend(customParseFormat);
|
||||
|
||||
export const MS_PER_SECOND = 1000;
|
||||
export const MS_PER_MINUTE = 60 * MS_PER_SECOND;
|
||||
@@ -72,6 +75,11 @@ export const formatDurationSplit = (ms) => {
|
||||
: { time: 0, format: "seconds" };
|
||||
};
|
||||
|
||||
export const toTimeStamp = (date, format) => {
|
||||
const dayJsDate = dayjs(date, format);
|
||||
return dayJsDate.valueOf();
|
||||
};
|
||||
|
||||
export const formatDate = (date, customOptions) => {
|
||||
const options = {
|
||||
year: "numeric",
|
||||
@@ -90,6 +98,6 @@ export const formatDate = (date, customOptions) => {
|
||||
};
|
||||
|
||||
export const formatDateWithTz = (timestamp, format, timezone) => {
|
||||
const formattedDate = dayjs(timestamp, timezone).tz(timezone).format(format);
|
||||
const formattedDate = dayjs(timestamp).tz(timezone).format(format);
|
||||
return formattedDate;
|
||||
};
|
||||
Reference in new issue
Block a user