CFE-16 description validating

This commit is contained in:
2023-11-20 11:15:50 +03:30
parent f2cdf2eb9d
commit 3d488e6220
2 changed files with 10 additions and 14 deletions

View File

@@ -2,24 +2,26 @@ import CallActionsCategories from "./CallActionCategories";
import CallActionsSubcategories from "./CallActionSubcategories";
import ActionHeader from "./ActionHeader";
import CallActionDescription from "./CallActionDescription";
import {CALL_ACTION} from "@/core/data/apiRoutes";
import useRequest from "@/lib/app/hooks/useRequest";
import useAnswers from "@/lib/callWidget/hooks/useAnswers";
import {useState} from "react";
import {Stack} from "@mui/material";
import {CALL_ACTION} from "@/core/data/apiRoutes";
function CallActions({tab}) {
const [description, setDescription] = useState()
const [description, setDescription] = useState("")
const requestServer = useRequest({auth: true});
const {closeAnswerTab} = useAnswers();
const handleSubcategoryButton = (category_id, subcategory_id) => {
let data = {}
data['category_id'] = category_id
data['subcategory_id'] = subcategory_id
if (description !== "")
data["description"] = description
requestServer(`${CALL_ACTION}/${tab.id}`, "post", {
data: {
category_id,
subcategory_id,
description
},
data
})
.then(() => {
closeAnswerTab(tab.id);

View File

@@ -49,13 +49,7 @@ export const AnswersProvider = ({children}) => {
categoryLists: [],
subCategoryLists: [],
});
const [state, dispatch] = useReducer(reducer, [{
id: 1,
phone_number: '09134849737',
date: new Date(),
active: true,
active_category_id: 1,
}]);
const [state, dispatch] = useReducer(reducer, []);
useEffect(() => {
requestServer(GET_CATEGORY, "get")