dix_error_add_empty_tag
This commit is contained in:
parent
3407250e92
commit
b34ba269c1
|
|
@ -12,7 +12,6 @@ import Header from "../../Components/exercise/Header";
|
||||||
import { Question } from "../../types/Item";
|
import { Question } from "../../types/Item";
|
||||||
import BaseForm from './Model/Malty/Add'
|
import BaseForm from './Model/Malty/Add'
|
||||||
import Form from './Model/Add'
|
import Form from './Model/Add'
|
||||||
import { toast } from "react-toastify";
|
|
||||||
const AcceptModal = lazy(() => import('./Model/AcceptModal'));
|
const AcceptModal = lazy(() => import('./Model/AcceptModal'));
|
||||||
|
|
||||||
import { useModalState } from "../../zustand/Modal";
|
import { useModalState } from "../../zustand/Modal";
|
||||||
|
|
@ -22,6 +21,7 @@ import { hasItems } from "../../utils/hasItems";
|
||||||
import { QUESTION_OBJECT_KEY } from "../../config/AppKey";
|
import { QUESTION_OBJECT_KEY } from "../../config/AppKey";
|
||||||
import useSaveOnDisconnect from "../../Hooks/useSaveOnDisconnect";
|
import useSaveOnDisconnect from "../../Hooks/useSaveOnDisconnect";
|
||||||
import { getLocalStorageQuestions } from "../../utils/setLocalStorageQuestions";
|
import { getLocalStorageQuestions } from "../../utils/setLocalStorageQuestions";
|
||||||
|
import { toast } from "react-toastify";
|
||||||
|
|
||||||
const AddPage: React.FC = () => {
|
const AddPage: React.FC = () => {
|
||||||
|
|
||||||
|
|
@ -82,13 +82,19 @@ const AddPage: React.FC = () => {
|
||||||
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
|
||||||
if (isSuccessAsync && ( SavedQuestionData?.Questions?.length > 0 ? isSuccess: true )) {
|
if (isSuccessAsync && ( SavedQuestionData?.Questions?.length > 0 ? isSuccess: true )) {
|
||||||
set_object_to_edit(null)
|
set_object_to_edit(null)
|
||||||
set_Success(true)
|
set_Success(true)
|
||||||
localStorage.removeItem(QUESTION_OBJECT_KEY)
|
localStorage.removeItem(QUESTION_OBJECT_KEY)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
if(isSuccess && !(SavedQuestionData?.Questions?.length)){
|
||||||
|
toast.success(t("validation.the_possess_done_successful"))
|
||||||
|
set_object_to_edit(null)
|
||||||
|
set_Success(true)
|
||||||
|
localStorage.removeItem(QUESTION_OBJECT_KEY)
|
||||||
|
}
|
||||||
}, [isSuccess,isSuccessAsync])
|
}, [isSuccess,isSuccessAsync])
|
||||||
|
|
||||||
let cleanedQuestionOptions = cleanObject(SavedQuestionData);
|
let cleanedQuestionOptions = cleanObject(SavedQuestionData);
|
||||||
|
|
@ -100,7 +106,6 @@ const AddPage: React.FC = () => {
|
||||||
|
|
||||||
const SavedData = getLocalStorageQuestions(QUESTION_OBJECT_KEY)
|
const SavedData = getLocalStorageQuestions(QUESTION_OBJECT_KEY)
|
||||||
|
|
||||||
console.log(SavedData);
|
|
||||||
const handleCancel = () => {
|
const handleCancel = () => {
|
||||||
if(!noChange){
|
if(!noChange){
|
||||||
navigate(-1)
|
navigate(-1)
|
||||||
|
|
@ -114,7 +119,6 @@ const AddPage: React.FC = () => {
|
||||||
|
|
||||||
const [t] = useTranslation();
|
const [t] = useTranslation();
|
||||||
|
|
||||||
console.log(SavedData?.isBase === 1);
|
|
||||||
|
|
||||||
if(isBseQuestion || SavedData?.isBase === 1){
|
if(isBseQuestion || SavedData?.isBase === 1){
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -104,7 +104,7 @@ export function processTags(DataToSend: any) {
|
||||||
}).filter((item:any) => item !== undefined);
|
}).filter((item:any) => item !== undefined);
|
||||||
|
|
||||||
const newTags = DataToSend?.tags?.map((item: any, index: number) => {
|
const newTags = DataToSend?.tags?.map((item: any, index: number) => {
|
||||||
if (typeof item?.id === "string") {
|
if (typeof item?.id === "string" && item?.name !== "" ) {
|
||||||
return { name: item?.name };
|
return { name: item?.name };
|
||||||
}
|
}
|
||||||
}).filter((item:any) => item !== undefined);
|
}).filter((item:any) => item !== undefined);
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
// export const BaseURL = "http://192.168.1.108:8000/api/";
|
// export const BaseURL = "http://192.168.1.108:8000/api/";
|
||||||
// export const BaseURL = "http://127.0.0.1:8000/api/";
|
export const BaseURL = "http://127.0.0.1:8000/api/";
|
||||||
|
|
||||||
export const BaseURL = "https://exercise-automation.point-dev.net/api/";
|
// export const BaseURL = "https://exercise-automation.point-dev.net/api/";
|
||||||
|
|
||||||
export const ImageBaseURL = "http://192.168.1.9:8000/";
|
export const ImageBaseURL = "http://192.168.1.9:8000/";
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user