diff --git a/public/locales/en/sources.json b/public/locales/en/sources.json
index b1af64be5..1962c0470 100644
--- a/public/locales/en/sources.json
+++ b/public/locales/en/sources.json
@@ -4,5 +4,6 @@
"sourceCardButton": "Access the source",
"sourceCreateCTAButton": "Create source",
"sourcesCreateSuccess": "Source created successfully",
- "sourcesCreateError": "Error while creating the source"
+ "sourcesCreateError": "Error while creating the source",
+ "sourcesErrorFetching": "Error fetching source"
}
diff --git a/public/locales/pt/sources.json b/public/locales/pt/sources.json
index dde0e8c2c..fd0637518 100644
--- a/public/locales/pt/sources.json
+++ b/public/locales/pt/sources.json
@@ -4,5 +4,6 @@
"sourceCardButton": "Acesse a fonte",
"sourceCreateCTAButton": "Incluir fonte",
"sourcesCreateSuccess": "Fonte criado com sucesso",
- "sourcesCreateError": "Erro ao criar a fonte"
+ "sourcesCreateError": "Erro ao criar a fonte",
+ "sourcesErrorFetching": "Erro ao buscar a fonte"
}
diff --git a/src/api/badgesApi.ts b/src/api/badgesApi.ts
index a0c16726c..913400a14 100644
--- a/src/api/badgesApi.ts
+++ b/src/api/badgesApi.ts
@@ -1,5 +1,5 @@
import axios from "axios";
-import { message } from "antd";
+import { MessageManager } from "../components/Messages";
const request = axios.create({
withCredentials: true,
@@ -10,11 +10,11 @@ const createBadge = (badge, users, t) => {
return request
.post(`/`, { ...badge, users })
.then((response) => {
- message.success(t("badges:badgeSaved"));
+ MessageManager.showMessage("success", `${t("badges:badgeSaved")}`);
return response.data;
})
.catch((err) => {
- message.error(err.response.data?.message);
+ MessageManager.showMessage("error", err.response.data?.message);
throw err;
});
};
@@ -23,11 +23,11 @@ const updateBadge = (badge, users, t) => {
return request
.put(`/${badge._id}`, { ...badge, users })
.then((response) => {
- message.success(t("badges:badgeSaved"));
+ MessageManager.showMessage("success", `${t("badges:badgeSaved")}`);
return response.data;
})
.catch((err) => {
- message.error(err.response.data?.message);
+ MessageManager.showMessage("error", err.response.data?.message);
throw err;
});
};
@@ -39,7 +39,7 @@ const getBadges = () => {
return response.data;
})
.catch((err) => {
- message.error(err.response.data?.message);
+ MessageManager.showMessage("error", err.response.data?.message);
throw err;
});
};
diff --git a/src/api/claim.ts b/src/api/claim.ts
index 121a8c380..587a6e31e 100644
--- a/src/api/claim.ts
+++ b/src/api/claim.ts
@@ -1,5 +1,5 @@
import axios from "axios";
-import { message } from "antd";
+import { MessageManager } from "../components/Messages";
import { NameSpaceEnum } from "../types/Namespace";
const request = axios.create({
@@ -53,7 +53,7 @@ const getById = (id, t, params = {}) => {
return response.data;
})
.catch(() => {
- message.error(t("claim:errorWhileFetching"));
+ MessageManager.showMessage("error", `${t("claim:errorWhileFetching")}`)
});
};
@@ -62,7 +62,7 @@ const saveSpeech = (t, claim = {}) => {
.post("/", claim)
.then((response) => {
const { title } = response.data;
- message.success(
+ MessageManager.showMessage("success",
`"${title}" ${t("claimForm:successCreateMessage")}`
);
return response.data;
@@ -73,7 +73,7 @@ const saveSpeech = (t, claim = {}) => {
// TODO: Track errors with Sentry
}
const { data } = response;
- message.error(
+ MessageManager.showMessage("error",
data && data.message
? data.message
: t("claimForm:errorCreateMessage")
@@ -86,14 +86,14 @@ const saveImage = (t, claimImage = {}) => {
.post("/image", claimImage)
.then((response) => {
const { title } = response.data;
- message.success(
+ MessageManager.showMessage("success",
`"${title}" ${t("claimForm:successCreateMessage")}`
);
return response.data;
})
.catch((err) => {
const response = err && err.response;
- message.error(
+ MessageManager.showMessage("error",
response?.data && response?.data.message
? response?.data.message
: t("claimForm:errorCreateMessage")
@@ -106,7 +106,7 @@ const saveDebate = (t, debate = {}) => {
.post("/debate", debate)
.then((response) => {
const { title } = response.data;
- message.success(
+ MessageManager.showMessage("success",
`"${title}" ${t("claimForm:successCreateMessage")}`
);
return response.data;
@@ -125,7 +125,7 @@ const saveUnattributed = (t, unattributed = {}) => {
.post("/unattributed", unattributed)
.then((response) => {
const { title } = response.data;
- message.success(
+ MessageManager.showMessage("success",
`"${title}" ${t("claimForm:successCreateMessage")}`
);
return response.data;
@@ -155,7 +155,7 @@ const updateDebate = (
// TODO: Track errors with Sentry
}
const { data } = response;
- message.error(
+ MessageManager.showMessage("error",
data && data.message
? data.message
: t("claimForm:errorUpdateMessage")
@@ -167,11 +167,11 @@ const deleteClaim = (id: string, t: any) => {
return request
.delete(`/${id}`)
.then(() => {
- message.success(t("claim:deleteSuccess"));
+ MessageManager.showMessage("success", t("claim:deleteSuccess"));
})
.catch((err) => {
console.error(err);
- message.error(t("claim:deleteError"));
+ MessageManager.showMessage("error", t("claim:deleteError"));
});
};
@@ -189,13 +189,13 @@ const updateClaimHiddenStatus = (
description,
})
.then(() => {
- message.success(
+ MessageManager.showMessage("success",
t(`claim:${isHidden ? "hideSuccess" : "unhideSuccess"}`)
);
})
.catch((err) => {
console.error(err);
- message.error(t(`claim:${isHidden ? "hideError" : "unhideError"}`));
+ MessageManager.showMessage("error", t(`claim:${isHidden ? "hideError" : "unhideError"}`));
});
};
diff --git a/src/api/claimReviewApi.ts b/src/api/claimReviewApi.ts
index faef3a9a4..69fd0b301 100644
--- a/src/api/claimReviewApi.ts
+++ b/src/api/claimReviewApi.ts
@@ -1,4 +1,4 @@
-import { message } from "antd";
+import { MessageManager } from "../components/Messages";
import axios from "axios";
import { NameSpaceEnum } from "../types/Namespace";
@@ -50,13 +50,13 @@ const updateClaimReviewHiddenStatus = (
return request
.put(`/review/${id}`, { isHidden, description, recaptcha })
.then((response) => {
- message.success(
+ MessageManager.showMessage("success",
t(`claimReview:${isHidden ? "hideSuccess" : "unhideSuccess"}`)
);
return response.data;
})
.catch((err) => {
- message.error(
+ MessageManager.showMessage("error",
t(`claimReview:${isHidden ? "hideError" : "unhideError"}`)
);
throw err;
@@ -67,11 +67,11 @@ const deleteClaimReview = (id: string, t: any) => {
return request
.delete(`/review/${id}`)
.then(() => {
- message.success(t("claim:deleteSuccess"));
+ MessageManager.showMessage("success", t("claim:deleteSuccess"));
})
.catch((err) => {
console.error(err);
- message.error(t("claim:deleteError"));
+ MessageManager.showMessage("error",t("claim:deleteError"));
});
};
diff --git a/src/api/comment.ts b/src/api/comment.ts
index 781c86716..ef672a65c 100644
--- a/src/api/comment.ts
+++ b/src/api/comment.ts
@@ -1,5 +1,5 @@
import axios from "axios";
-import { message } from "antd";
+import { MessageManager } from "../components/Messages";
const request = axios.create({
withCredentials: true,
@@ -13,7 +13,7 @@ const createComment = (comment) => {
return response.data;
})
.catch((err) => {
- message.error(err.response.data?.message);
+ MessageManager.showMessage("error", err.response.data?.message);
throw err;
});
};
@@ -25,7 +25,7 @@ const updateComments = (comments) => {
return response.data;
})
.catch((err) => {
- message.error(err.response.data?.message);
+ MessageManager.showMessage("error", err.response.data?.message);
throw err;
});
};
@@ -37,7 +37,7 @@ const updateComment = (commentId, comment) => {
return response.data;
})
.catch((err) => {
- message.error(err.response.data?.message);
+ MessageManager.showMessage("error", err.response.data?.message);
throw err;
});
};
@@ -49,7 +49,7 @@ const createReplyComment = (commentId, newComment) => {
return response.data;
})
.catch((err) => {
- message.error(err.response.data?.message);
+ MessageManager.showMessage("error", err.response.data?.message);
throw err;
});
};
@@ -61,7 +61,7 @@ const deleteReplyComment = (commentId, replyCommentId) => {
return response.data;
})
.catch((err) => {
- message.error(err.response.data?.message);
+ MessageManager.showMessage("error", err.response.data?.message);
throw err;
});
};
diff --git a/src/api/dailyReport.ts b/src/api/dailyReport.ts
index 785da871a..e86ae9adf 100644
--- a/src/api/dailyReport.ts
+++ b/src/api/dailyReport.ts
@@ -1,4 +1,4 @@
-import { message } from "antd";
+import { MessageManager } from "../components/Messages";
import axios from "axios";
const request = axios.create({
@@ -10,11 +10,11 @@ const sendDailyReportEmail = (topic, nameSpace, t) => {
return request
.post(`/topic/${topic}/send/${nameSpace}`)
.then((response) => {
- message.success(t("notification:sendDailyReportSuccess"));
+ MessageManager.showMessage("success", t("notification:sendDailyReportSuccess"));
return response.data;
})
.catch((err) => {
- message.error(t("notification:sendDailyReportError"));
+ MessageManager.showMessage("error",t("notification:sendDailyReportError"));
throw err;
});
};
diff --git a/src/api/editor.ts b/src/api/editor.ts
index 11100675f..023d32fb8 100644
--- a/src/api/editor.ts
+++ b/src/api/editor.ts
@@ -1,5 +1,5 @@
import axios from "axios";
-import { message } from "antd";
+import { MessageManager } from "../components/Messages";
const request = axios.create({
withCredentials: true,
@@ -13,7 +13,7 @@ const update = (reference, editorContentObject, t) => {
return response;
})
.catch((err) => {
- message.error(t(`claim:${err.response.data?.message}`));
+ MessageManager.showMessage("error", t(`claim:${err.response.data?.message}`));
throw err;
});
};
diff --git a/src/api/image.ts b/src/api/image.ts
index 4dcb64fe1..f8a217846 100644
--- a/src/api/image.ts
+++ b/src/api/image.ts
@@ -1,5 +1,5 @@
import axios from "axios";
-import { message } from "antd";
+import { MessageManager } from "../components/Messages";
const request = axios.create({
withCredentials: true,
@@ -24,7 +24,7 @@ const uploadImage = (files, t) => {
return response.data;
})
.catch((err) => {
- message.error(t(`claim:${err.response.data.message}`));
+ MessageManager.showMessage("error", t(`claim:${err.response.data.message}`));
throw err;
});
};
@@ -33,11 +33,11 @@ const createClaimTypeImage = (file) => {
return request
.post("/create", file)
.then((response) => {
- message.success("upload success");
+ MessageManager.showMessage("success", "upload success");
return response.data;
})
.catch((err) => {
- message.error("upload failed");
+ MessageManager.showMessage("error", "upload failed");
throw err;
});
};
diff --git a/src/api/namespace.ts b/src/api/namespace.ts
index 5ecee358d..7f2c68dbb 100644
--- a/src/api/namespace.ts
+++ b/src/api/namespace.ts
@@ -1,5 +1,5 @@
import axios from "axios";
-import { message } from "antd";
+import { MessageManager } from "../components/Messages";
const request = axios.create({
withCredentials: true,
@@ -10,11 +10,11 @@ const createNameSpace = (nameSpace, t) => {
return request
.post(`/`, { ...nameSpace })
.then((response) => {
- message.success(t("namespaces:nameSpaceSaved"));
+ MessageManager.showMessage("success", t("namespaces:nameSpaceSaved"));
return response.data;
})
.catch((err) => {
- message.error(err.response.data?.message);
+ MessageManager.showMessage("error", err.response.data?.message);
throw err;
});
};
@@ -23,11 +23,11 @@ const updateNameSpace = (nameSpace, t) => {
return request
.put(`/${nameSpace._id}`, { ...nameSpace })
.then((response) => {
- message.success(t("namespaces:nameSpaceSaved"));
+ MessageManager.showMessage("success", t("namespaces:nameSpaceSaved"));
return response.data;
})
.catch((err) => {
- message.error(err.response.data?.message);
+ MessageManager.showMessage("error", err.response.data?.message);
throw err;
});
};
@@ -39,7 +39,7 @@ const getNameSpaces = () => {
return response.data;
})
.catch((err) => {
- message.error(err.response.data?.message);
+ MessageManager.showMessage("error", err.response.data?.message);
throw err;
});
};
diff --git a/src/api/ory.ts b/src/api/ory.ts
index 72b383a31..b5e01f088 100644
--- a/src/api/ory.ts
+++ b/src/api/ory.ts
@@ -2,7 +2,7 @@
import { ory } from "../lib/orysdk";
import { handleFlowError } from "../lib/orysdk/errors";
import { AxiosError } from "axios";
-import { message } from "antd";
+import { MessageManager } from "../components/Messages";
const oryGetLoginFlow = ({ router, setFlow, t }) => {
const { return_to: returnTo, flow: flowId, refresh, aal } = router.query;
@@ -59,10 +59,10 @@ const orySubmitLogin = ({ router, flow, setFlow, t, values, shouldGoBack }) => {
});
})
.then(() => {
- message.success(`${t("login:loginSuccessfulMessage")}`);
+ MessageManager.showMessage("success", `${t("login:loginSuccessfulMessage")}`);
if (flow?.return_to) {
window.location.href = flow?.return_to;
- message.success(t("profile:changesSaved"));
+ MessageManager.showMessage("success", t("profile:changesSaved"));
return;
}
if (shouldGoBack) {
@@ -73,7 +73,7 @@ const orySubmitLogin = ({ router, flow, setFlow, t, values, shouldGoBack }) => {
})
.catch(handleFlowError(router, "login", setFlow, t))
.catch(() => {
- message.error(`${t("login:loginFailedMessage")}`);
+ MessageManager.showMessage("error", `${t("login:loginFailedMessage")}`);
});
};
@@ -94,7 +94,7 @@ const orySubmitSettings = ({ router, flow, setFlow, t, values }) => {
})
.then(() => {
router.push("/");
- message.success(t("profile:changesSaved"));
+ MessageManager.showMessage("success", `${t("profile:changesSaved")}`);
})
.catch(handleFlowError(router, "settings", setFlow, t));
};
@@ -107,7 +107,7 @@ const orySubmitTotp = ({ router, flow, setFlow, t, values }) => {
})
.then(({ data }) => {
setFlow(data);
- message.success(t("profile:changesSaved"));
+ MessageManager.showMessage("success", `${t("profile:changesSaved")}`);
})
.catch(handleFlowError(router, "settings", setFlow, t));
};
diff --git a/src/api/personality.ts b/src/api/personality.ts
index 810238614..a92e3e9f8 100644
--- a/src/api/personality.ts
+++ b/src/api/personality.ts
@@ -1,5 +1,5 @@
import axios from "axios";
-import { message } from "antd";
+import { MessageManager } from "../components/Messages";
import { ActionTypes } from "../store/types";
import { NameSpaceEnum } from "../types/Namespace";
@@ -67,7 +67,7 @@ const getPersonality = (id, params, t) => {
return response.data;
})
.catch(() => {
- message.error(t("personality:errorWhileFetching"));
+ MessageManager.showMessage("error", t("personality:errorWhileFetching"));
});
};
@@ -78,7 +78,7 @@ const createPersonality = (personality, t) => {
})
.then((response) => {
const { name } = response.data;
- message.success(
+ MessageManager.showMessage("success",
`"${name}" ${t("personalityCreateForm:successMessage")}`
);
return response.data;
@@ -91,7 +91,7 @@ const createPersonality = (personality, t) => {
// console.log(err);
}
const { data } = response;
- message.error(
+ MessageManager.showMessage("error",
data && data.message
? data.message
: t("personalityCreateForm:errorMessage")
@@ -103,11 +103,11 @@ const deletePersonality = (id: string, t: any) => {
return axios
.delete(`${baseUrl}/${id}`)
.then(() => {
- message.success(t("personality:deleteSuccess"));
+ MessageManager.showMessage("success", t("personality:deleteSuccess"));
})
.catch((err) => {
console.error(err);
- message.error(t("personality:deleteError"));
+ MessageManager.showMessage("error", t("personality:deleteError"));
});
};
@@ -125,13 +125,13 @@ const updatePersonalityHiddenStatus = (
description,
})
.then(() => {
- message.success(
+ MessageManager.showMessage("success",
t(`personality:${isHidden ? "hideSuccess" : "unhideSuccess"}`)
);
})
.catch((err) => {
console.error(err);
- message.error(
+ MessageManager.showMessage("error",
t(`personality:${isHidden ? "hideError" : "unhideError"}`)
);
});
diff --git a/src/api/reviewTaskApi.ts b/src/api/reviewTaskApi.ts
index e4d54829e..10e5b0de2 100644
--- a/src/api/reviewTaskApi.ts
+++ b/src/api/reviewTaskApi.ts
@@ -1,4 +1,4 @@
-import { message } from "antd";
+import { MessageManager } from "../components/Messages";
import axios from "axios";
import { NameSpaceEnum } from "../types/Namespace";
@@ -48,11 +48,11 @@ const createReviewTask = (params, t, type) => {
return request
.post("/", { ...params })
.then((response) => {
- message.success(t(`reviewTask:${type}_SUCCESS`));
+ MessageManager.showMessage("success", t(`reviewTask:${type}_SUCCESS`));
return response.data;
})
.catch((err) => {
- message.error(t(`reviewTask:${type}_ERROR`));
+ MessageManager.showMessage("error", t(`reviewTask:${type}_ERROR`));
throw err;
});
};
@@ -61,7 +61,7 @@ const autoSaveDraft = (params, t) => {
return request
.put(`/${params.data_hash}`, { ...params })
.then((response) => {
- message.success(t(`reviewTask:SAVE_DRAFT_SUCCESS`));
+ MessageManager.showMessage("success", t(`reviewTask:SAVE_DRAFT_SUCCESS`));
return response.data;
})
.catch((err) => {
diff --git a/src/api/sentenceApi.ts b/src/api/sentenceApi.ts
index 579897dfb..e326abde7 100644
--- a/src/api/sentenceApi.ts
+++ b/src/api/sentenceApi.ts
@@ -1,5 +1,5 @@
import axios from "axios";
-import { message } from "antd";
+import { MessageManager } from "../components/Messages";
const request = axios.create({
withCredentials: true,
@@ -21,11 +21,11 @@ const deleteSentenceTopic = (topics, data_hash, t) => {
return request
.put(`/${data_hash}`, topics)
.then((response) => {
- message.success(t("topics:deleteTopics"));
+ MessageManager.showMessage("success", t("topics:deleteTopics"));
return response.data;
})
.catch((err) => {
- message.error(t("topics:deleteTopicsError"));
+ MessageManager.showMessage("error", t("topics:deleteTopicsError"));
throw err;
});
};
diff --git a/src/api/sourceApi.ts b/src/api/sourceApi.ts
index 235f965c1..0e385a082 100644
--- a/src/api/sourceApi.ts
+++ b/src/api/sourceApi.ts
@@ -1,4 +1,4 @@
-import { message } from "antd";
+import { MessageManager } from "../components/Messages";
import axios from "axios";
import { NameSpaceEnum } from "../types/Namespace";
@@ -68,7 +68,7 @@ const createSource = (t, router, source: any = {}) => {
return request
.post("/", source)
.then((response) => {
- message.success(t("sources:sourcesCreateSuccess"));
+ MessageManager.showMessage("success", t("sources:sourcesCreateSuccess"));
router.push(
nameSpace === NameSpaceEnum.Main
? "/sources"
@@ -78,7 +78,7 @@ const createSource = (t, router, source: any = {}) => {
})
.catch((err) => {
console.error(err);
- message.error(t("sources:sourcesCreateError"));
+ MessageManager.showMessage("error", t("sources:sourcesCreateError"));
});
};
@@ -89,7 +89,7 @@ const getById = (id, t, params = {}) => {
return response.data;
})
.catch(() => {
- message.error("error"); //TODO: Improve feedback message
+ MessageManager.showMessage("error", t("sources:sourcesErrorFetching"));
});
};
diff --git a/src/api/topicsApi.ts b/src/api/topicsApi.ts
index 3cd2435fa..6660b6069 100644
--- a/src/api/topicsApi.ts
+++ b/src/api/topicsApi.ts
@@ -1,5 +1,5 @@
import axios from "axios";
-import { message } from "antd";
+import { MessageManager } from "../components/Messages";
import { ActionTypes } from "../store/types";
interface IGetTopicsOptions {
@@ -13,7 +13,7 @@ const request = axios.create({
baseURL: `/api/topics`,
});
-const searchTopics = ({ query, dispatch }) => {
+const searchTopics = ({ query, dispatch, t }) => {
const params = { query };
return request
.get(`/search`, { params })
@@ -26,7 +26,7 @@ const searchTopics = ({ query, dispatch }) => {
return topicResults;
})
.catch((e) => {
- message.error("Failed to fetch topics");
+ MessageManager.showMessage("error", t("topics:getTopicsFailed"));
return [];
});
};
@@ -58,11 +58,11 @@ const createTopics = (params, t) => {
return request
.post("/", { ...params })
.then((response) => {
- message.success(t("topics:createTopicsSuccess"));
+ MessageManager.showMessage("success", t("topics:createTopicsSuccess"));
return response.data;
})
.catch((err) => {
- message.error(t("topics:createTopicsError"));
+ MessageManager.showMessage("error", t("topics:createTopicsError"));
throw err;
});
};
diff --git a/src/api/userApi.ts b/src/api/userApi.ts
index d076f1253..550ecca83 100644
--- a/src/api/userApi.ts
+++ b/src/api/userApi.ts
@@ -1,5 +1,5 @@
import axios from "axios";
-import { message } from "antd";
+import { MessageManager } from "../components/Messages";
import { Roles, Status } from "../types/enums";
import { Badge } from "../types/Badge";
@@ -17,7 +17,7 @@ const getById = (id, params = {}) => {
return response.data;
})
.catch(() => {
- message.error("Error while fetching User");
+ MessageManager.showMessage("error", "Error while fetching User");
});
};
@@ -28,7 +28,7 @@ const getByOryId = (id) => {
return response.data;
})
.catch(() => {
- message.error("Error while fetching User");
+ MessageManager.showMessage("error", "Error while fetching User");
});
};
@@ -70,14 +70,14 @@ const register = (params, t) => {
return request
.post(`/register`, { ...params })
.then((response) => {
- message.success(t("login:signupSuccessfulMessage"));
+ MessageManager.showMessage("success", t("login:signupSuccessfulMessage"));
return response?.data;
})
.catch((e) => {
if (e.response?.status === 409) {
- message.error(t("login:userAlreadyExists"));
+ MessageManager.showMessage("error", t("login:userAlreadyExists"));
} else {
- message.error(t("login:signupFailedMessage"));
+ MessageManager.showMessage("error", t("login:signupFailedMessage"));
}
return e?.response?.data;
});
@@ -111,11 +111,11 @@ const update = (
return request
.put(`/${userId}`, params)
.then((response) => {
- message.success(t("admin:roleUpdated"));
+ MessageManager.showMessage("success", t("admin:roleUpdated"));
return response?.data;
})
.catch((e) => {
- message.error(t("admin:roleUpdateFailed"));
+ MessageManager.showMessage("error", t("admin:roleUpdateFailed"));
return e?.response?.data;
});
};
diff --git a/src/api/verificationRequestApi.ts b/src/api/verificationRequestApi.ts
index 481be7fd6..65df273a7 100644
--- a/src/api/verificationRequestApi.ts
+++ b/src/api/verificationRequestApi.ts
@@ -1,6 +1,6 @@
import axios from "axios";
import { ActionTypes } from "../store/types";
-import { message } from "antd";
+import { MessageManager } from "../components/Messages";
import { NameSpaceEnum } from "../types/Namespace";
interface SearchOptions {
searchText?: string;
@@ -25,7 +25,7 @@ const createVerificationRequest = (
return request
.post("/", verificationRequest)
.then((response) => {
- message.success(
+ MessageManager.showMessage("success",
t("verificationRequest:verificationRequestCreateSuccess")
);
router.push(
@@ -37,7 +37,7 @@ const createVerificationRequest = (
})
.catch((err) => {
console.error(err);
- message.error(
+ MessageManager.showMessage("error",
t("verificationRequest:verificationRequestCreateError")
);
});
@@ -113,13 +113,13 @@ const updateVerificationRequest = (id, params, t) => {
return request
.put(`/${id}`, params)
.then((response) => {
- message.success(
+ MessageManager.showMessage("success",
t("verificationRequest:addVerificationRequestSuccess")
);
return response.data;
})
.catch((e) => {
- message.error(t("verificationRequest:addVerificationRequestError"));
+ MessageManager.showMessage("error", t("verificationRequest:addVerificationRequestError"));
console.error("error while updating verification request", e);
});
};
@@ -128,13 +128,13 @@ const removeVerificationRequestFromGroup = (id, params, t) => {
return request
.put(`/${id}/group`, params)
.then((response) => {
- message.success(
+ MessageManager.showMessage("success",
t("verificationRequest:removeVerificationRequestSuccess")
);
return response.data;
})
.catch((e) => {
- message.error(
+ MessageManager.showMessage("error",
t("verificationRequest:removeVerificationRequestError")
);
console.error("error while removing verification request", e);
@@ -145,11 +145,11 @@ const deleteVerificationRequestTopic = (topics, data_hash, t) => {
return request
.put(`/${data_hash}/topics`, topics)
.then((response) => {
- message.success(t("topics:deleteTopics"));
+ MessageManager.showMessage("success", t("topics:deleteTopics"));
return response.data;
})
.catch((err) => {
- message.error(t("topics:deleteTopicsError"));
+ MessageManager.showMessage("error", t("topics:deleteTopicsError"));
throw err;
});
};
diff --git a/src/components/Claim/CreateClaim/ClaimSelectPersonality.tsx b/src/components/Claim/CreateClaim/ClaimSelectPersonality.tsx
index 661545a33..bf952f66b 100644
--- a/src/components/Claim/CreateClaim/ClaimSelectPersonality.tsx
+++ b/src/components/Claim/CreateClaim/ClaimSelectPersonality.tsx
@@ -1,5 +1,5 @@
-import { Card, CardActions, CardContent } from "@mui/material";
-import { Col, message, Row } from "antd";
+import { Grid, Card, CardActions, CardContent } from "@mui/material";
+import { MessageManager } from "../../../components/Messages";
import { useAtom } from "jotai";
import { useTranslation } from "next-i18next";
@@ -34,7 +34,7 @@ const ClaimSelectPersonality = () => {
const addPersonality = (personality) => {
if (claimData.personalities.some((p) => p._id === personality._id)) {
- message.info(t("claimForm:personalityAlreadyAdded"));
+ MessageManager.showMessage("info", t("claimForm:personalityAlreadyAdded"));
return;
}
send({
@@ -50,7 +50,7 @@ const ClaimSelectPersonality = () => {
const continueWithPersonality = () => {
if (claimData.personalities.length !== 0) {
send(CreateClaimEvents.savePersonality);
- } else message.warning(t("claimForm:selectPersonalityText"));
+ } else MessageManager.showMessage("warning", t("claimForm:selectPersonalityText"));
};
const continueWithoutPersonality = () => {
@@ -107,11 +107,11 @@ const ClaimSelectPersonality = () => {
>
{t("claimForm:selectedPersonalities")}
-