CFE-16 description validating
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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")
|
||||
|
||||
Reference in New Issue
Block a user