Commit 4c649483 authored by Kim, Subin's avatar Kim, Subin
Browse files

서버 요청 수정중

parent 6db177d9
import axios from "axios";
import baseUrl from "../utils/baseUrl.js";
const submit = async (sendData) => {
const { data } = await axios.post(`${baseUrl}/`, sendData);
return data
}
const scheduleApi = {
submit
}
export default scheduleApi
\ No newline at end of file
import { useState, useEffect } from "react"; import { useState, useEffect } from "react";
import { Redirect, useLocation } from "react-router-dom"; import { Redirect, useLocation } from "react-router-dom";
import BtnGroup from "../Buttons/BtnGroup.js"; import BtnGroup from "../Buttons/BtnGroup.js";
import scheduleApi from "../../apis/schedule.api.js";
import catchErrors from "../../utils/catchErrors.js"; import catchErrors from "../../utils/catchErrors.js";
import styles from "./form.module.scss"; import styles from "./form.module.scss";
...@@ -55,6 +56,7 @@ const ScheduleForm = () => { ...@@ -55,6 +56,7 @@ const ScheduleForm = () => {
try { try {
setError("") setError("")
if (schedule.allDay === "on") setSchedule({ ...schedule, startTime: '00:00', endTime: '23:59' }) if (schedule.allDay === "on") setSchedule({ ...schedule, startTime: '00:00', endTime: '23:59' })
await scheduleApi.submit()
setSuccess(true) setSuccess(true)
} catch (error) { } catch (error) {
catchErrors(error, setError) catchErrors(error, setError)
...@@ -68,6 +70,7 @@ const ScheduleForm = () => { ...@@ -68,6 +70,7 @@ const ScheduleForm = () => {
return ( return (
<form className="pt-5" onSubmit={handleSubmit}> <form className="pt-5" onSubmit={handleSubmit}>
{console.log("data==",)}
<div> <div>
<input className={`form-control form-control-lg shadow-none rounded-0 px-1 mb-5 ${styles.textInput}`} type="text" name="title" placeholder="제목" aria-label="title" onChange={handleChange} autoFocus /> <input className={`form-control form-control-lg shadow-none rounded-0 px-1 mb-5 ${styles.textInput}`} type="text" name="title" placeholder="제목" aria-label="title" onChange={handleChange} autoFocus />
</div> </div>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment