Merge branch 'dev' into 'staging'
Dev See merge request frontend/marketplace!130
This commit is contained in:
commit
1ea4064229
@ -54,7 +54,8 @@ function Drawers() {
|
||||
|
||||
closeCartDrawer()
|
||||
navigate("payment")
|
||||
return enqueueSnackbar(payCartError);
|
||||
if (!payCartError.includes("insufficient funds: ")) enqueueSnackbar(payCartError);
|
||||
return
|
||||
}
|
||||
|
||||
if (payCartResponse) {
|
||||
|
@ -34,12 +34,13 @@ export default function TotalPrice({ priceAfterDiscounts, priceBeforeDiscounts,
|
||||
if (payCartError.includes("insufficient funds: ")) {
|
||||
const notEnoughMoneyAmount = parseInt(payCartError.replace(/^.*insufficient\sfunds:\s(?=\d+$)/, ""));
|
||||
|
||||
console.log(notEnoughMoneyAmount);
|
||||
setNotEnoughMoneyAmount(notEnoughMoneyAmount);
|
||||
}
|
||||
|
||||
setLoading(false);
|
||||
|
||||
return enqueueSnackbar(payCartError);
|
||||
if (!payCartError.includes("insufficient funds: ")) enqueueSnackbar(payCartError);
|
||||
return
|
||||
}
|
||||
|
||||
if (payCartResponse) {
|
||||
|
@ -18,6 +18,8 @@ import { withErrorBoundary } from "react-error-boundary"
|
||||
import { handleComponentError } from "@root/utils/handleComponentError"
|
||||
import { OnChangeLoginPassword } from "./onChangeLoginPassword"
|
||||
|
||||
export type LP = "email" | "password" | "all" | ""
|
||||
|
||||
function AccountSettings() {
|
||||
const theme = useTheme()
|
||||
const upMd = useMediaQuery(theme.breakpoints.up("md"))
|
||||
@ -31,8 +33,8 @@ function AccountSettings() {
|
||||
const comment = useUserStore((state) => state.comment)
|
||||
const userId = useUserStore((state) => state.userId) ?? ""
|
||||
|
||||
const [onChangeTypeLP, setOnChangeTypeLP] = useState<"email" | "password" | "all" | "">("")
|
||||
|
||||
const [onChangeTypeLP, setOnChangeTypeLP] = useState<LP>("")
|
||||
|
||||
const [readySend, setReadySend] = useState(false)
|
||||
const [loginPasswordFocus, setLoginPasswordFocus] = useState(false)
|
||||
|
||||
@ -133,10 +135,11 @@ function AccountSettings() {
|
||||
flexDirection: upMd ? "row" : "column",
|
||||
}}
|
||||
>
|
||||
<UserFields
|
||||
<UserFields
|
||||
loginPasswordFocus={loginPasswordFocus}
|
||||
setLoginPasswordFocus={setLoginPasswordFocus}
|
||||
/>
|
||||
setOnChangeTypeLP={setOnChangeTypeLP}
|
||||
/>
|
||||
<Box
|
||||
sx={{
|
||||
maxWidth: "246px",
|
||||
|
@ -2,15 +2,17 @@ import { Box, useMediaQuery, useTheme } from "@mui/material"
|
||||
import InputTextfield from "@components/InputTextfield"
|
||||
import PasswordInput from "@components/passwordInput"
|
||||
import { setSettingsField, useUserStore } from "@root/stores/user"
|
||||
import type { LP } from "./AccountSettings"
|
||||
|
||||
interface Props {
|
||||
loginPasswordFocus: boolean;
|
||||
setLoginPasswordFocus: (a:boolean) => void;
|
||||
setOnChangeTypeLP: (a:LP) => void;
|
||||
}
|
||||
|
||||
export default function UserFields({
|
||||
loginPasswordFocus,
|
||||
setLoginPasswordFocus
|
||||
setLoginPasswordFocus,
|
||||
setOnChangeTypeLP
|
||||
}: Props) {
|
||||
const theme = useTheme()
|
||||
const upSm = useMediaQuery(theme.breakpoints.up("sm"))
|
||||
@ -98,6 +100,7 @@ export default function UserFields({
|
||||
}}
|
||||
onBlur={() => {
|
||||
setLoginPasswordFocus(false)
|
||||
if (settingsFields.email.value !== user?.email) setOnChangeTypeLP("email")
|
||||
}}
|
||||
id="email"
|
||||
label="Изменить E-mail"
|
||||
@ -128,6 +131,7 @@ export default function UserFields({
|
||||
}}
|
||||
onBlur={() => {
|
||||
setLoginPasswordFocus(false)
|
||||
if (settingsFields.password.value.length > 0) setOnChangeTypeLP("password")
|
||||
}}
|
||||
|
||||
onChange={(e) => setSettingsField("password", e.target.value)}
|
||||
|
@ -16,7 +16,6 @@ const translateMessage: Record<string, string> = {
|
||||
"user with this email or login is exist": "Пользователь уже существует",
|
||||
"user with this login is exist": "Пользователь с таким логином уже существует",
|
||||
"unauthorized": "Ссылка просрочена",
|
||||
"insufficient funds: 910000": "Недостаточно средств"
|
||||
}
|
||||
|
||||
export const parseAxiosError = (nativeError: unknown): [string, number?] => {
|
||||
|
Loading…
Reference in New Issue
Block a user