storing survey data locally without saving
This commit is contained in:
parent
4d96cbaab1
commit
a75275c7de
5 changed files with 106 additions and 56 deletions
|
|
@ -1,10 +1,11 @@
|
|||
import React, {useState} from 'react';
|
||||
import React from 'react';
|
||||
import SurveyInfo from "../SurveyInfo/SurveyInfo.tsx";
|
||||
import styles from "./SettingSurvey.module.css";
|
||||
import TimeEvent from "../TimeEvent/TimeEvent.tsx";
|
||||
import SaveButton from "../SaveButton/SaveButton.tsx";
|
||||
import {ISurvey} from "../../api/SurveyApi.ts";
|
||||
import {useLocation, useOutletContext} from "react-router-dom";
|
||||
import {useSurveyContext} from "../../context/SurveyContext.tsx";
|
||||
|
||||
|
||||
const SettingSurvey: React.FC = () => {
|
||||
|
|
@ -14,9 +15,7 @@ const SettingSurvey: React.FC = () => {
|
|||
survey: ISurvey;
|
||||
setSurvey: (survey: ISurvey) => void;
|
||||
}>();
|
||||
|
||||
const [descriptionSurvey, setDescriptionSurvey] = useState('');
|
||||
const [titleSurvey, setTitleSurvey] = useState('');
|
||||
const { tempSurvey, setTempSurvey } = useSurveyContext();
|
||||
|
||||
const handleCopyLink = () => {
|
||||
if (!survey?.id)
|
||||
|
|
@ -31,10 +30,10 @@ const SettingSurvey: React.FC = () => {
|
|||
<div className={styles.settingSurvey}>
|
||||
{isSettingCreatePage ? (
|
||||
<SurveyInfo
|
||||
titleSurvey={titleSurvey}
|
||||
descriptionSurvey={descriptionSurvey}
|
||||
setDescriptionSurvey={setDescriptionSurvey}
|
||||
setTitleSurvey={setTitleSurvey}
|
||||
titleSurvey={tempSurvey.title}
|
||||
descriptionSurvey={tempSurvey.description}
|
||||
setDescriptionSurvey={(value) => setTempSurvey({ ...tempSurvey, description: value })}
|
||||
setTitleSurvey={(value) => setTempSurvey({ ...tempSurvey, title: value })}
|
||||
/>
|
||||
) : (
|
||||
<SurveyInfo
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue