[Update] Add success notification when deepL Auth key has updated successfully.
This commit is contained in:
@@ -15,7 +15,7 @@ export const useNotificationStatus = () => {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
const showNotification_Success = (message) => {
|
const showNotification_Success = (message, options = {}) => {
|
||||||
updateNotificationStatus({
|
updateNotificationStatus({
|
||||||
status: "success",
|
status: "success",
|
||||||
is_open: true,
|
is_open: true,
|
||||||
|
|||||||
@@ -1,7 +1,11 @@
|
|||||||
import { useStore_DeepLAuthKey } from "@store";
|
import { useStore_DeepLAuthKey } from "@store";
|
||||||
import { useStdoutToPython } from "@logics/useStdoutToPython";
|
import { useStdoutToPython } from "@logics/useStdoutToPython";
|
||||||
|
import { useTranslation } from "react-i18next";
|
||||||
|
import { useNotificationStatus } from "@logics_common";
|
||||||
|
|
||||||
export const useDeepLAuthKey = () => {
|
export const useDeepLAuthKey = () => {
|
||||||
|
const { t } = useTranslation();
|
||||||
|
const { showNotification_Success, showNotification_Error } = useNotificationStatus();
|
||||||
const { asyncStdoutToPython } = useStdoutToPython();
|
const { asyncStdoutToPython } = useStdoutToPython();
|
||||||
const { currentDeepLAuthKey, updateDeepLAuthKey, pendingDeepLAuthKey } = useStore_DeepLAuthKey();
|
const { currentDeepLAuthKey, updateDeepLAuthKey, pendingDeepLAuthKey } = useStore_DeepLAuthKey();
|
||||||
|
|
||||||
@@ -14,6 +18,10 @@ export const useDeepLAuthKey = () => {
|
|||||||
pendingDeepLAuthKey();
|
pendingDeepLAuthKey();
|
||||||
asyncStdoutToPython("/set/data/deepl_auth_key", selected_deepl_auth_key);
|
asyncStdoutToPython("/set/data/deepl_auth_key", selected_deepl_auth_key);
|
||||||
};
|
};
|
||||||
|
const saveSuccessDeepLAuthKey = (saved_deepl_auth_key) => {
|
||||||
|
updateDeepLAuthKey(saved_deepl_auth_key);
|
||||||
|
showNotification_Success(t("config_page.translation.deepl_auth_key.auth_key_success"));
|
||||||
|
};
|
||||||
|
|
||||||
const deleteDeepLAuthKey = () => {
|
const deleteDeepLAuthKey = () => {
|
||||||
pendingDeepLAuthKey();
|
pendingDeepLAuthKey();
|
||||||
@@ -25,6 +33,7 @@ export const useDeepLAuthKey = () => {
|
|||||||
getDeepLAuthKey,
|
getDeepLAuthKey,
|
||||||
updateDeepLAuthKey,
|
updateDeepLAuthKey,
|
||||||
setDeepLAuthKey,
|
setDeepLAuthKey,
|
||||||
|
saveSuccessDeepLAuthKey,
|
||||||
deleteDeepLAuthKey,
|
deleteDeepLAuthKey,
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
@@ -148,7 +148,7 @@ export const useReceiveRoutes = () => {
|
|||||||
const { updateSpeakerPhraseTimeout } = useSpeakerPhraseTimeout();
|
const { updateSpeakerPhraseTimeout } = useSpeakerPhraseTimeout();
|
||||||
const { updateSpeakerMaxWords } = useSpeakerMaxWords();
|
const { updateSpeakerMaxWords } = useSpeakerMaxWords();
|
||||||
|
|
||||||
const { updateDeepLAuthKey } = useDeepLAuthKey();
|
const { updateDeepLAuthKey, saveSuccessDeepLAuthKey } = useDeepLAuthKey();
|
||||||
const { updateSelectedCTranslate2WeightType } = useSelectedCTranslate2WeightType();
|
const { updateSelectedCTranslate2WeightType } = useSelectedCTranslate2WeightType();
|
||||||
const {
|
const {
|
||||||
updateDownloadedCTranslate2WeightTypeStatus,
|
updateDownloadedCTranslate2WeightTypeStatus,
|
||||||
@@ -352,7 +352,7 @@ export const useReceiveRoutes = () => {
|
|||||||
|
|
||||||
// Translation
|
// Translation
|
||||||
"/get/data/deepl_auth_key": updateDeepLAuthKey,
|
"/get/data/deepl_auth_key": updateDeepLAuthKey,
|
||||||
"/set/data/deepl_auth_key": updateDeepLAuthKey,
|
"/set/data/deepl_auth_key": saveSuccessDeepLAuthKey,
|
||||||
"/delete/data/deepl_auth_key": () => updateDeepLAuthKey(""),
|
"/delete/data/deepl_auth_key": () => updateDeepLAuthKey(""),
|
||||||
|
|
||||||
"/get/data/ctranslate2_weight_type": updateSelectedCTranslate2WeightType,
|
"/get/data/ctranslate2_weight_type": updateSelectedCTranslate2WeightType,
|
||||||
|
|||||||
Reference in New Issue
Block a user