Skip to content

Commit

Permalink
Merge branch 'main' of https://github.com/info-dsm/INFO_v1_FrontEnd i…
Browse files Browse the repository at this point in the history
…nto #29-CreateNotice
  • Loading branch information
drainxc committed Nov 15, 2022
2 parents 5a20114 + e9aa45a commit 3d91377
Show file tree
Hide file tree
Showing 18 changed files with 776 additions and 79 deletions.
22 changes: 21 additions & 1 deletion src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,14 @@ import { BrowserRouter, Route, Routes } from "react-router-dom";
import RecruitmentList from "./components/pages/companyPage/recruitmentList";
import RequstManage from "./components/pages/teacherPage/manage";
import TeacherList from "./components/pages/teacherPage/list";
import CompanySignIn from "./components/pages/companyPage/auth/signIn";
import CompanySignUp from "./components/pages/companyPage/auth/signUp";
import StudentSignIn from "./components/pages/studentPage/auth/signIn";
import StudentSignUp from "./components/pages/studentPage/auth/signUp";
import TeacherSignUp from "./components/pages/teacherPage/auth/signUp";
import TeacherSignIn from "./components/pages/teacherPage/auth/signIn";
import ShowCompany from "./components/pages/teacherPage/company/list";
import SearchProps from "./components/pages/teacherPage/company/search";
function App() {
const queryClient = new QueryClient();
return (
Expand All @@ -21,12 +29,24 @@ function App() {
<BrowserRouter>
<GlobalStyle />
<Routes>
<Route path="/company/login" element={<CompanySignIn />} />
<Route path="/company/signup" element={<CompanySignUp />} />
<Route path="/student/login" element={<StudentSignIn />} />
<Route path="/student/signup" element={<StudentSignUp />} />
<Route path="/teacher/login" element={<TeacherSignIn />} />
<Route path="/teacher/signup" element={<TeacherSignUp />} />
<Route path="/company/list" element={<RecruitmentList />} />

<Route
path="/company/list/write"
element={<RequstResistration />}
/>
<Route path="/teacher/list/item" element={<RequstManage />} />
<Route path="/teacher" element={<ShowCompany />} />
<Route path="/teacher/:companyId" element={<SearchProps />} />
<Route
path="/teacher/list/:noticeId"
element={<RequstManage />}
/>
<Route path="/teacher/list" element={<TeacherList />} />
</Routes>
<Footer />
Expand Down
12 changes: 8 additions & 4 deletions src/components/api/company/requesrResistration/index.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import { useQuery } from "@tanstack/react-query";
import axios from "axios";
import { BaseUrl } from "../../../../export/base";
import { Notice } from "../../../common/notice";
import { useNavigate } from "react-router-dom";
const token =
"eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiIxNiIsInR5cGUiOiJhY2Nlc3MiLCJpYXQiOjE2NjgzMTI4MTksImV4cCI6MTY2ODM5OTIxOX0.Xa8JlV2OyvwTvjV35kKCZrmfWI7mxN89UifM4UX_GYM";
"eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiIxNiIsInR5cGUiOiJhY2Nlc3MiLCJpYXQiOjE2Njg0NTMwNzgsImV4cCI6MTY2ODUzOTQ3OH0.Px0CiC-ZakXX0axx85c19fil7K4zJeoCTPAxmlqumDI";
export const getListProps = () => {
// eslint-disable-next-line react-hooks/rules-of-hooks
return useQuery(["datas"], async () => {
Expand Down Expand Up @@ -50,8 +52,6 @@ export const getListProps = () => {
});
};
export const postNotice = (arr, ad) => {
console.log(arr);
console.log(ad);
let formData = new FormData();
for (let i in arr) {
formData.append("attachment", arr[i]);
Expand All @@ -71,7 +71,11 @@ export const postNotice = (arr, ad) => {
"Access-Control-Allow-Origin": "*",
},
data: formData,
});
})
.then((res) => {
Notice({ state: "success", message: "정상적으로 처리되었습니다." });
})
.catch((err) => Notice({ state: "error", message: err.message }));
};
export const getMyList = () => {
// eslint-disable-next-line react-hooks/rules-of-hooks
Expand Down
23 changes: 23 additions & 0 deletions src/components/api/reisue/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import axios from "axios";
import { BaseUrl } from "../../../export/base";
import { useQuery } from "@tanstack/react-query";
export const Reissue = async () => {
const refresh = localStorage.getItem("refreshToken");
const token = localStorage.getItem("accessToken");
await axios({
url: BaseUrl + "/auth/reissue",
method: "post",
body: {
accessToken: token,
refreshToken: refresh,
},
}).then(({ accessToken, refreshToken }) => {
localStorage.setItem("accessToken", accessToken);
localStorage.setItem("refreshToken", refreshToken);
});
};
export const PostReissue = () => {
useQuery(["reissue"], async () => Reissue(), {
staleTime: 171800000,
});
};
80 changes: 62 additions & 18 deletions src/components/api/teacher/index.js
Original file line number Diff line number Diff line change
@@ -1,33 +1,39 @@
import { useQuery } from "@tanstack/react-query";
import axios from "axios";
import { BaseUrl } from "../../../export/base";
import { Notice } from "../../common/notice";
const token =
"eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiIyNSIsInR5cGUiOiJhY2Nlc3MiLCJpYXQiOjE2NjgzODEzNzUsImV4cCI6MTY2ODQ2Nzc3NX0.5BpCYYQQ_slpXRWtm3wdSjW-_VrKOnKK1KJ4R-MdY58";
export const getBoardList = () => {
// eslint-disable-next-line react-hooks/rules-of-hooks
return useQuery(["getBoardList"], async () => {
const { data } = await axios({
method: "get",
url: BaseUrl + "/notice",
params: { id: 134953727 },
headers: {
Authorization: `Bearer ${token}`,
},
});
console.log(data);
return data;
"eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiIyNSIsInR5cGUiOiJhY2Nlc3MiLCJpYXQiOjE2Njg0Njg1NDgsImV4cCI6MTY2ODU1NDk0OH0.6G9f1-8wdnEGCDn0ABzT-e4LUVsRhSnxXsNvZrxBqOk";
export const getBoardList = async (id) => {
const { data } = await axios({
method: "get",
url: BaseUrl + "/notice",
params: { id: id },
headers: {
Authorization: `Bearer ${token}`,
},
});
return data;
};
export const noticeRequest = async (method, path, query) => {
const { data } = await axios({
export const getNoticeItem = (id) => {
// eslint-disable-next-line react-hooks/rules-of-hooks
return useQuery(["noticeItem", id], () => getBoardList(id));
};
export const noticeRequest = async (method, path, query, message) => {
await axios({
method: method,
url: BaseUrl + path,
params: { noticeId: query },
headers: {
Authorization: `Bearer ${token}`,
},
});
console.log(data);
})
.then((res) => {
Notice({ state: "seccess", message: message });
})
.catch((err) => {
Notice({ state: "error", message: err.message });
});
};
export const postNoticeRequest = async (idx, path) => {
let res;
Expand Down Expand Up @@ -115,3 +121,41 @@ export const postNotice = (idx, path) => {
}
);
};
export const getCompanyRequest = async (idx) => {
let data;
await axios({
method: "get",
url: BaseUrl + "/company/list",
params: {
idx: idx,
size: 8,
},
headers: {
Authorization: `Bearer ${token}`,
},
}).then((res) => {
data = res.data;
});
console.log(data);
return data;
};
export const getCompany = (idx) => {
// eslint-disable-next-line react-hooks/rules-of-hooks
return useQuery(["list", idx], async () => getCompanyRequest(idx), {
keepPreviousData: true,
});
};
export const getCompanyName = (id) => {
// eslint-disable-next-line react-hooks/rules-of-hooks
return useQuery(["list", id], async () => {
const { data } = await axios({
method: "get",
url: BaseUrl + "/company/search",
params: { query: id },
headers: {
Authorization: `Bearer ${token}`,
},
});
return data;
});
};
25 changes: 25 additions & 0 deletions src/components/common/nav/index.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import styled from "styled-components";
import { StyledLink } from "../../../style/theme";
const NavProps = ({ props, idx }) => {
return (
<>
<Table>
{props.map((user, i) => (
<>
<StyledLink>{user}</StyledLink>
</>
))}
</Table>
</>
);
};
export default NavProps;
const Table = styled.div`
position: relative;
width: 100vw;
height: 100px;
color: ${(props) => props.theme.colors.black};
`;
const Ul = styled.ul`
position: relative;
`;
10 changes: 7 additions & 3 deletions src/components/pages/companyPage/recruitmentList/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import ResistrationList from "./list";
import LoadingPage from "../../../common/loading";
import ErrorPage from "../../../common/error";
import { getMyList } from "../../../api/company/requesrResistration";
import { StyledLink } from "../../../../style/theme";
const RecruitmentList = () => {
const { status, data } = getMyList();
return (
Expand All @@ -21,9 +22,12 @@ const RecruitmentList = () => {
/>
<MainDiv>
<List>
<AddBtn>
<button>+</button>
</AddBtn>
<StyledLink to="/company/list/write">
<AddBtn>
<button>+</button>
</AddBtn>
</StyledLink>

<ResistrationList data={data} />
</List>
</MainDiv>
Expand Down
13 changes: 5 additions & 8 deletions src/components/pages/companyPage/requestResistration/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import { value } from "../../../../redux/store/selectValue";
import * as s from "./style";
import { postNotice } from "../../../api/company/requesrResistration";
import { open } from "../../../common/addresshook";
import { useNavigate } from "react-router-dom";
const RequstResistration = () => {
const modal = useSelector((state) => state.modal.state.modalrequest);
const Data = useSelector((stack) => stack.selectValue.recruitmentRequest);
Expand All @@ -34,6 +35,7 @@ const RequstResistration = () => {
const InputRef = useRef([]);
const WorkRef = useRef([]);
const WelfareRef = useRef();
const navigate = useNavigate();
const dispatch = useDispatch();
const handleComplete = (data) => {
let fullAddress = data.address;
Expand Down Expand Up @@ -81,7 +83,6 @@ const RequstResistration = () => {
(e) => {
const ad = [...file, ...e.target.files];
setFile(ad);
console.log(file);
},
[file]
);
Expand All @@ -108,11 +109,7 @@ const RequstResistration = () => {
dispatch(value(ad));
};
const submit = () => {
console.log(MealRef.current[0].checked);
console.log(BokRef.current[0].checked);
console.log(BokRef.current[0].value);
let arr = [];
console.log(InputRef.current[0].id);
for (let i = 0; i < InputRef.current.length; i++) {
console.log(InputRef.current[i].id);
const find = (e) => {
Expand Down Expand Up @@ -163,7 +160,7 @@ const RequstResistration = () => {
as = {
...ad,
workPlace: {
isSameWithCompanyAddress: true,
isSameWithCompanyAddress: false,
otherPlace: locate.text,
},
isPersonalContact: state,
Expand All @@ -172,13 +169,13 @@ const RequstResistration = () => {
as = {
...ad,
workPlace: {
isSameWithCompanyAddress: false,
isSameWithCompanyAddress: true,
},
isPersonalContact: state,
};
}
console.log(as);
postNotice(file, as);
navigate("/company/list");
};
return (
<>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ import { useState, useCallback, useEffect, useRef } from "react";
import * as s from "./style";
import { value } from "../../../../../redux/store/selectValue";
import AutoComplete from "../../../../common/autocomplete";
import Swal from "sweetalert2";
import { getListProps } from "../../../../api/company/requesrResistration";
import LoadingPage from "../../../../common/loading";
import ErrorPage from "../../../../common/error";
import { Notice } from "../../../../common/notice";
const SelectModal = () => {
const { status, data } = getListProps();
const dispatch = useDispatch();
Expand Down Expand Up @@ -167,38 +167,19 @@ const SelectModal = () => {
};
console.log(arr3);
if (radio.id === "") {
Swal.fire({
title: "버튼을 체크해주세요..",
icon: "error",
confirmButtonText: "Ok",
});
Notice({ state: "error", message: "버튼을 체크해주세요..." });
} else if (NumRef.current.value === "" || NumRef.current.value === "0") {
Swal.fire({
title: "명 수를 입력해주세요..",
icon: "error",
confirmButtonText: "Ok",
});
Notice({ state: "error", message: "명 수를 입력해주세요..." });
} else if (TextRef.current.value === "") {
Swal.fire({
title: "상세직무를 입력해주세요..",
icon: "error",
confirmButtonText: "Ok",
});
Notice({ state: "error", message: "상세직무를 입력해주세요..." });
} else if (arr1.length === 0) {
Swal.fire({
title: "사용언어를 입력해주세요..",
icon: "error",
confirmButtonText: "Ok",
});
Notice({ state: "error", message: "사용언어를 입력해주세요..." });
} else if (arr2.length === 0) {
Swal.fire({
title: "사용스킬을 입력해주세요..",
icon: "error",
confirmButtonText: "Ok",
});
Notice({ state: "error", message: "사용스킬을 입력해주세요..." });
} else if (ArrStateData.length === ArrStateCountData) {
dispatch(value([...ArrStateData, props]));
dispatch(stateModal(false));
Notice({ state: "success", message: "정상적으로 처리되었습니다." });
} else {
const ad = ArrStateData.map((el, i) => {
if (i === ArrStateCountData) {
Expand All @@ -209,6 +190,7 @@ const SelectModal = () => {
return el;
}
});
Notice({ state: "success", message: "정상적으로 처리되었습니다." });
dispatch(value(ad));
dispatch(stateModal(false));
}
Expand Down
Loading

0 comments on commit 3d91377

Please sign in to comment.