fix PutPrivilegies

This commit is contained in:
ArtChaos189 2023-05-20 16:36:46 +03:00 committed by Nastya
parent c1fb3865c6
commit ab603c35c2
2 changed files with 28 additions and 9 deletions

@ -1,24 +1,33 @@
import ModeEditOutlineOutlinedIcon from "@mui/icons-material/ModeEditOutlineOutlined";
import { Box, IconButton, TextField, Tooltip, Typography } from "@mui/material";
import axios from "axios";
import { useState } from "react";
import axios from "axios";
import { Box, IconButton, TextField, Tooltip, Typography } from "@mui/material";
import ModeEditOutlineOutlinedIcon from "@mui/icons-material/ModeEditOutlineOutlined";
interface CardPrivilegie {
name: string;
type: string;
price: string;
description: string;
value: string;
privilegeId: string;
serviceKey: string;
}
export const СardPrivilegie = ({ name, type, price, description }: CardPrivilegie) => {
export const СardPrivilegie = ({ name, type, price, description, value, privilegeId, serviceKey }: CardPrivilegie) => {
const [inputOpen, setInputOpen] = useState<boolean>(false);
const [inputValue, setInputValue] = useState<string>("");
const PutPrivilegies = () => {
axios({
method: "put",
url: "https://admin.pena.digital/strator/privilege/service",
url: "https://admin.pena.digital/strator/privilege/",
data: {
name: name,
privilegeId: privilegeId,
serviceKey: serviceKey,
description: description,
type: type,
value: value,
price: inputValue,
},
});
@ -85,6 +94,7 @@ export const СardPrivilegie = ({ name, type, price, description }: CardPrivileg
<Box sx={{ width: "600px", display: "flex", justifyContent: "space-around" }}>
{inputOpen ? (
<TextField
type="number"
onKeyDown={onCloseInput}
onKeyPress={requestOnclickEnter}
placeholder="введите число"

@ -1,4 +1,4 @@
import { useState } from "react";
import { useEffect, useState } from "react";
import { Box, SxProps, Theme, Typography, useMediaQuery, useTheme } from "@mui/material";
@ -127,10 +127,19 @@ export const PrivilegiesWrapper = ({ text, sx, result }: CustomWrapperProps) =>
</Box>
{isExpanded &&
(isError ? (
<Typography>errorMessage</Typography>
<Typography>{errorMessage}</Typography>
) : (
privilegies?.Шаблонизатор.map(({ name, type, price, description }) => (
<СardPrivilegie key={type} name={name} type={type} price={price} description={description} />
privilegies?.Шаблонизатор.map(({ name, type, price, description, value, privilegeId, serviceKey }) => (
<СardPrivilegie
key={type}
name={name}
type={type}
price={price}
value={value}
privilegeId={privilegeId}
serviceKey={serviceKey}
description={description}
/>
))
))}
</Box>