Web: Refactoring.

This commit is contained in:
Tatiana Lopaeva 2023-09-20 14:49:41 +03:00
parent b4ef526071
commit cf2a44cbd0
3 changed files with 6 additions and 13 deletions

View File

@ -1,7 +1,6 @@
import React, { useState } from "react";
import { useState } from "react";
import { useTranslation } from "react-i18next";
import PropTypes from "prop-types";
import { inject, observer } from "mobx-react";
import { conversionToBytes } from "@docspace/common/utils";
import TextInput from "@docspace/components/text-input";
@ -123,6 +122,7 @@ const QuotaForm = ({
</div>
{isButtonsEnable && (
<SaveCancelButtons
isSaving={isLoading}
onSaveClick={onSaveClick}
onCancelClick={onCancelClick}
saveButtonLabel={t("Common:SaveButton")}
@ -148,11 +148,4 @@ QuotaForm.propTypes = {
initialPower: PropTypes.number,
};
export default inject(({ auth }) => {
const { currentQuotaStore } = auth;
const { setUserQuota } = currentQuotaStore;
return {
setUserQuota,
};
})(observer(QuotaForm));
export default QuotaForm;

View File

@ -28,7 +28,7 @@ const QuotaPerUserComponent = (props) => {
console.log("onSaveUserQuota", size);
timerId = setTimeout(() => setIsLoading(true), 200);
await setUserQuota(size);
await setUserQuota(size, t);
timerId && clearTimeout(timerId);
timerId = null;

View File

@ -248,12 +248,12 @@ class QuotasStore {
}
};
setUserQuota = async (quota, isEnable = true, t) => {
setUserQuota = async (quota, t, isEnable = true) => {
const quotaSize = isEnable ? quota : -1;
try {
await setDefaultUserQuota(isEnable, quotaSize);
toastr.success(t("Common:MemoryQuotaEnabled"));
toastr.success(t("MemoryQuotaEnabled"));
} catch (e) {
toastr.error(e);
}