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