Merge branch 'payment-response' into 'staging'
Payment response See merge request frontend/marketplace!128
This commit is contained in:
commit
b2de52aa02
@ -49,12 +49,13 @@ export async function sendPayment({
|
||||
}
|
||||
}
|
||||
|
||||
export const sendRSPayment = async (): Promise<string | null> => {
|
||||
export const sendRSPayment = async (money: number): Promise<string | null> => {
|
||||
try {
|
||||
await makeRequest<never, string>({
|
||||
await makeRequest<unknown, string>({
|
||||
url: apiUrl + "/wallet/rspay",
|
||||
method: "POST",
|
||||
useToken: true,
|
||||
body: {money: money},
|
||||
withCredentials: false,
|
||||
});
|
||||
|
||||
|
@ -33,6 +33,7 @@ import Oferta from "@root/docs/content/oferta"
|
||||
import PrivacyPolicy from "@root/docs/content/PrivacyPolicy"
|
||||
import RecoverPassword from "@root/pages/auth/RecoverPassword"
|
||||
import OutdatedLink from "@root/pages/auth/OutdatedLink"
|
||||
import { verify } from "./pages/AccountSettings/helper"
|
||||
|
||||
pdfjs.GlobalWorkerOptions.workerSrc = new URL("pdfjs-dist/build/pdf.worker.min.js", import.meta.url).toString()
|
||||
|
||||
@ -42,6 +43,7 @@ const App = () => {
|
||||
const userId = useUserStore((state) => state.userId)
|
||||
const navigate = useNavigate()
|
||||
|
||||
console.log(userId)
|
||||
useUserFetcher({
|
||||
url: process.env.REACT_APP_DOMAIN + `/user/${userId}`,
|
||||
userId,
|
||||
@ -71,6 +73,8 @@ const App = () => {
|
||||
},
|
||||
})
|
||||
|
||||
verify(userId)
|
||||
|
||||
console.log(location)
|
||||
if (location.state?.redirectTo)
|
||||
return <Navigate to={location.state.redirectTo} replace state={{ backgroundLocation: location }} />
|
||||
|
@ -30,9 +30,9 @@ function AccountSettings() {
|
||||
const comment = useUserStore((state) => state.comment)
|
||||
const userId = useUserStore((state) => state.userId) ?? ""
|
||||
|
||||
useEffect(() => {
|
||||
verify(userId)
|
||||
}, [])
|
||||
// useEffect(() => {
|
||||
// verify(userId)
|
||||
// }, [])
|
||||
|
||||
const textFieldProps = {
|
||||
gap: upMd ? "16px" : "10px",
|
||||
|
@ -44,7 +44,8 @@ const updateVerificationStatus = (verification: Verification) => {
|
||||
setVerificationStatus(VerificationStatus.NOT_VERIFICATED)
|
||||
}
|
||||
|
||||
export const verify = async (id: string) => {
|
||||
export const verify = async (id: string | null) => {
|
||||
if (id !== null && id.length > 0) {
|
||||
const [verificationResult, verificationError] = await verification(id)
|
||||
|
||||
if (verificationError) {
|
||||
@ -68,4 +69,6 @@ export const verify = async (id: string) => {
|
||||
|
||||
devlog("User", verificationResult)
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -185,8 +185,14 @@ export default function Payment() {
|
||||
|
||||
return;
|
||||
}
|
||||
console.log(paymentValueField)
|
||||
if (Number(paymentValueField) < 900){
|
||||
enqueueSnackbar("Минимальная сумма 900р")
|
||||
|
||||
const sendRSPaymentError = await sendRSPayment();
|
||||
return;
|
||||
}
|
||||
|
||||
const sendRSPaymentError = await sendRSPayment(Number(paymentValueField));
|
||||
|
||||
if (sendRSPaymentError) {
|
||||
return enqueueSnackbar(sendRSPaymentError);
|
||||
|
Loading…
Reference in New Issue
Block a user