format all files
This commit is contained in:
1 parent
bfa6197ee4
commit
1b81251c93
81 files changed
+2628
-2330
No files matched your search
@@ -2,26 +2,26 @@ import { useState } from "react";
|
||||
import { networkService } from "../main";
|
||||
|
||||
export const useBulkMonitors = () => {
|
||||
const [isLoading, setIsLoading] = useState(false);
|
||||
const [isLoading, setIsLoading] = useState(false);
|
||||
|
||||
const createBulkMonitors = async (file, user) => {
|
||||
setIsLoading(true);
|
||||
const createBulkMonitors = async (file, user) => {
|
||||
setIsLoading(true);
|
||||
|
||||
const formData = new FormData();
|
||||
formData.append("csvFile", file);
|
||||
formData.append("userId", user._id);
|
||||
formData.append("teamId", user.teamId);
|
||||
const formData = new FormData();
|
||||
formData.append("csvFile", file);
|
||||
formData.append("userId", user._id);
|
||||
formData.append("teamId", user.teamId);
|
||||
|
||||
try {
|
||||
const response = await networkService.createBulkMonitors(formData);
|
||||
return [true, response.data, null]; // [success, data, error]
|
||||
} catch (err) {
|
||||
const errorMessage = err?.response?.data?.msg || err.message;
|
||||
return [false, null, errorMessage];
|
||||
} finally {
|
||||
setIsLoading(false);
|
||||
}
|
||||
};
|
||||
try {
|
||||
const response = await networkService.createBulkMonitors(formData);
|
||||
return [true, response.data, null]; // [success, data, error]
|
||||
} catch (err) {
|
||||
const errorMessage = err?.response?.data?.msg || err.message;
|
||||
return [false, null, errorMessage];
|
||||
} finally {
|
||||
setIsLoading(false);
|
||||
}
|
||||
};
|
||||
|
||||
return [createBulkMonitors, isLoading];
|
||||
return [createBulkMonitors, isLoading];
|
||||
};
|
||||
@@ -2,7 +2,6 @@ import { useCallback } from "react";
|
||||
import { useTheme } from "@mui/material";
|
||||
|
||||
const useMonitorUtils = () => {
|
||||
|
||||
const getMonitorWithPercentage = useCallback((monitor, theme) => {
|
||||
let uptimePercentage = "";
|
||||
let percentageColor = "";
|
||||
|
||||
@@ -20,18 +20,20 @@ const useSendTestEmail = () => {
|
||||
setError(null);
|
||||
|
||||
// Send the test email with or without configuration
|
||||
const response = await networkService.sendTestEmail({
|
||||
const response = await networkService.sendTestEmail({
|
||||
to: user.email,
|
||||
emailConfig
|
||||
emailConfig,
|
||||
});
|
||||
|
||||
|
||||
if (typeof response?.data?.data?.messageId !== "undefined") {
|
||||
createToast({
|
||||
body: t("settingsTestEmailSuccess", "Test email sent successfully"),
|
||||
});
|
||||
} else {
|
||||
throw new Error(response?.data?.error || t("settingsTestEmailFailed", "Failed to send test email"));
|
||||
|
||||
throw new Error(
|
||||
response?.data?.error ||
|
||||
t("settingsTestEmailFailed", "Failed to send test email")
|
||||
);
|
||||
}
|
||||
} catch (error) {
|
||||
createToast({
|
||||
@@ -39,10 +41,14 @@ const useSendTestEmail = () => {
|
||||
});
|
||||
setError(error);
|
||||
createToast({
|
||||
body: t("settingsTestEmailFailedWithReason", "Failed to send test email: {{reason}}", {
|
||||
reason: error.message || t("settingsTestEmailUnknownError", "Unknown error")
|
||||
}),
|
||||
variant: "error"
|
||||
body: t(
|
||||
"settingsTestEmailFailedWithReason",
|
||||
"Failed to send test email: {{reason}}",
|
||||
{
|
||||
reason: error.message || t("settingsTestEmailUnknownError", "Unknown error"),
|
||||
}
|
||||
),
|
||||
variant: "error",
|
||||
});
|
||||
} finally {
|
||||
setIsSending(false);
|
||||
|
||||
Reference in new issue
Block a user