fix PutPrivilegies
This commit is contained in:
parent
c1fb3865c6
commit
ab603c35c2
@ -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 { 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 {
|
interface CardPrivilegie {
|
||||||
name: string;
|
name: string;
|
||||||
type: string;
|
type: string;
|
||||||
price: string;
|
price: string;
|
||||||
description: 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 [inputOpen, setInputOpen] = useState<boolean>(false);
|
||||||
const [inputValue, setInputValue] = useState<string>("");
|
const [inputValue, setInputValue] = useState<string>("");
|
||||||
|
|
||||||
const PutPrivilegies = () => {
|
const PutPrivilegies = () => {
|
||||||
axios({
|
axios({
|
||||||
method: "put",
|
method: "put",
|
||||||
url: "https://admin.pena.digital/strator/privilege/service",
|
url: "https://admin.pena.digital/strator/privilege/",
|
||||||
data: {
|
data: {
|
||||||
|
name: name,
|
||||||
|
privilegeId: privilegeId,
|
||||||
|
serviceKey: serviceKey,
|
||||||
|
description: description,
|
||||||
|
type: type,
|
||||||
|
value: value,
|
||||||
price: inputValue,
|
price: inputValue,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
@ -85,6 +94,7 @@ export const СardPrivilegie = ({ name, type, price, description }: CardPrivileg
|
|||||||
<Box sx={{ width: "600px", display: "flex", justifyContent: "space-around" }}>
|
<Box sx={{ width: "600px", display: "flex", justifyContent: "space-around" }}>
|
||||||
{inputOpen ? (
|
{inputOpen ? (
|
||||||
<TextField
|
<TextField
|
||||||
|
type="number"
|
||||||
onKeyDown={onCloseInput}
|
onKeyDown={onCloseInput}
|
||||||
onKeyPress={requestOnclickEnter}
|
onKeyPress={requestOnclickEnter}
|
||||||
placeholder="введите число"
|
placeholder="введите число"
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { useState } from "react";
|
import { useEffect, useState } from "react";
|
||||||
|
|
||||||
import { Box, SxProps, Theme, Typography, useMediaQuery, useTheme } from "@mui/material";
|
import { Box, SxProps, Theme, Typography, useMediaQuery, useTheme } from "@mui/material";
|
||||||
|
|
||||||
@ -127,10 +127,19 @@ export const PrivilegiesWrapper = ({ text, sx, result }: CustomWrapperProps) =>
|
|||||||
</Box>
|
</Box>
|
||||||
{isExpanded &&
|
{isExpanded &&
|
||||||
(isError ? (
|
(isError ? (
|
||||||
<Typography>errorMessage</Typography>
|
<Typography>{errorMessage}</Typography>
|
||||||
) : (
|
) : (
|
||||||
privilegies?.Шаблонизатор.map(({ name, type, price, description }) => (
|
privilegies?.Шаблонизатор.map(({ name, type, price, description, value, privilegeId, serviceKey }) => (
|
||||||
<СardPrivilegie key={type} name={name} type={type} price={price} description={description} />
|
<СardPrivilegie
|
||||||
|
key={type}
|
||||||
|
name={name}
|
||||||
|
type={type}
|
||||||
|
price={price}
|
||||||
|
value={value}
|
||||||
|
privilegeId={privilegeId}
|
||||||
|
serviceKey={serviceKey}
|
||||||
|
description={description}
|
||||||
|
/>
|
||||||
))
|
))
|
||||||
))}
|
))}
|
||||||
</Box>
|
</Box>
|
||||||
|
Loading…
Reference in New Issue
Block a user