Commit 617ce4d0 authored by Kim, Subin's avatar Kim, Subin
Browse files

병합 충돌 해결

parent 04f7c521
...@@ -2,22 +2,21 @@ import { useState, useEffect } from 'react'; ...@@ -2,22 +2,21 @@ import { useState, useEffect } from 'react';
import { Redirect, useParams } from 'react-router-dom'; import { Redirect, useParams } from 'react-router-dom';
import { useAuth } from '../../utils/context.js'; import { useAuth } from '../../utils/context.js';
import BtnGroup from "../Buttons/BtnGroup"; import BtnGroup from "../Buttons/BtnGroup";
import styles from "./form.module.scss";
import subjectApi from '../../apis/subject.api'; import subjectApi from '../../apis/subject.api';
import catchErrors from '../../utils/catchErrors.js'; import catchErrors from '../../utils/catchErrors.js';
import styles from "./form.module.scss";
const SubjectForm = () => { const SubjectForm = () => {
const { user } = useAuth(); const { user } = useAuth();
const { subjectId } = useParams(); const { subjectId } = useParams();
const [success, setSuccess] = useState(false) const [success, setSuccess] = useState(false)
const [error, setError] = useState(""); const [error, setError] = useState("");
const [disabled, setDisabled] = useState(true)
const [subject, setSubject] = useState({ const [subject, setSubject] = useState({
lectureName: "", lectureName: "",
prof: "", prof: "",
classRoom: "" classRoom: ""
}) })
const [disabled, setDisabled] = useState(true)
useEffect(() => { useEffect(() => {
getInfo(subjectId); getInfo(subjectId);
...@@ -39,12 +38,10 @@ const SubjectForm = () => { ...@@ -39,12 +38,10 @@ const SubjectForm = () => {
function handleChange(e) { function handleChange(e) {
const { name, value } = e.target const { name, value } = e.target
setSubject({ ...subject, [name]: value }) setSubject({ ...subject, [name]: value })
} }
async function getInfo(id) { async function getInfo(id) {
const result = await subjectApi.getSubInfo(id) const result = await subjectApi.getSubInfo(id)
console.log('과목수정 result확인', result)
setSubject({ setSubject({
lectureName: result.name, lectureName: result.name,
prof: result.prof, prof: result.prof,
...@@ -75,14 +72,12 @@ const SubjectForm = () => { ...@@ -75,14 +72,12 @@ const SubjectForm = () => {
} }
} }
if (success) { if (success) {
return <Redirect to="/studyplan" /> return <Redirect to="/studyplan" />
} }
return ( return (
<>
<div className="position-absolute top-50 start-50 translate-middle" style={{ width: "80%" }}> <div className="position-absolute top-50 start-50 translate-middle" style={{ width: "80%" }}>
<div> <div>
<div className="mb-5 d-flex flex-row"> <div className="mb-5 d-flex flex-row">
...@@ -99,10 +94,9 @@ const SubjectForm = () => { ...@@ -99,10 +94,9 @@ const SubjectForm = () => {
</div> </div>
</div> </div>
<div className="pt-2"> <div className="pt-2">
<BtnGroup disabled={disabled} handleSubmit={handleSubmit} /> <BtnGroup text={subjectId} disabled={disabled} handleSubmit={handleSubmit} />
</div> </div>
</div> </div>
</>
) )
} }
......
import { Link, Redirect } from "react-router-dom"; import { Link } from "react-router-dom";
import { useAuth } from "../../utils/context.js"; import { useAuth } from "../../utils/context.js";
import moment from "moment"; import moment from "moment";
import styles from "./menu.module.scss"; import styles from "./menu.module.scss";
const Menu = () => { const Menu = () => {
const { logout } = useAuth(); const { logout } = useAuth();
return ( return (
<> <>
<button className="btn btn-crimson shadow-none mt-2" type="button" data-bs-toggle="collapse" data-bs-target="#menuContent" aria-controls="menuContent" aria-expanded="false" aria-label="menu"> <button className="btn btn-crimson shadow-none mt-2" type="button" data-bs-toggle="collapse" data-bs-target="#menuContent" aria-controls="menuContent" aria-expanded="false" aria-label="menu">
......
import { Link } from "react-router-dom"; import { Link } from "react-router-dom";
import StudyPlanCard from "./Card/StudyPlanCard.js"; import StudyPlanCard from "./Card/StudyPlanCard.js";
const StudyPlanList = () => { const StudyPlanList = () => {
return ( return (
<> <>
<div> <StudyPlanCard />
<StudyPlanCard />
</div>
<div className="d-flex justify-content-center mt-3"> <div className="d-flex justify-content-center mt-3">
<Link className="text-decoration-none link-dark" to="/subject/edit" style={{ width: "20rem" }}> <Link className="card text-decoration-none link-dark" to="/subject/edit" style={{ width: "20rem" }}>
<div className="card"> <div className="card-body d-flex flex-column bg-secondary bg-opacity-25">
<div className="card-body d-flex flex-column bg-secondary bg-opacity-25 "> <div>
<div> <i className="bi bi-plus-lg d-flex justify-content-center fs-3"></i>
<i className="bi bi-plus-lg d-flex justify-content-center fs-3"></i> <p className="card-text mt-2 text-center">새로운 과목 추가하기</p>
<p className="card-text mt-2 text-center">새로운 과목 추가하기</p>
</div>
</div> </div>
</div> </div>
</Link> </Link>
......
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