EditSurvey.tsx 566 Bytes
Newer Older
Yoon, Daeki's avatar
Yoon, Daeki committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
import React from "react";
import { useLocation } from "react-router-dom";
import { surveyApi } from "../apis";
import { ISurvey } from "../types";
import { ModifySurvey } from "./ModifySurvey";

export const EditSurvey = () => {
  const location = useLocation();
  const surveyState = location.state as ISurvey;
  console.log("edit survey:", surveyState);

  const update = async (surveyData: ISurvey) => {
    const result = await surveyApi.updateSurvey(surveyData);
    return result;
  };

  return <ModifySurvey surveyData={surveyState} callApi={update} />;
};