MainPage.js
1.38 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
import React,{useEffect} from 'react';
import './MainPage.scss';
import {Button} from "antd";
import axios from 'axios';
import mainImg from "../assets/main-soldier.png";
import {getSurvey, getSurveySuccess, getSurveyError} from '../store/action/survey';
import { useDispatch } from 'react-redux';
function MainPage({history}){
const dispatch = useDispatch();
const onClick = () => {
history.push('/survey');
}
useEffect(()=>{
const getApi = async() =>{
dispatch(getSurvey());
try{
const {data} = await axios.get("getquestions");
dispatch(getSurveySuccess(data));
}catch(e){
dispatch(getSurveyError(e));
}
}
getApi();
},[]);
return(
<>
<div className="main-wrapper">
<div className="main-title">KHUSAT</div>
<div className="main-title__desc">
KHUSAT 특별과정, <br></br>
여러분의 보직을 추천드립니다.
</div>
<Button
size="large"
onClick={onClick}
color="#536349"
style={{}}
> 시작하기</Button>
<img className="main-image" src={mainImg}/>
</div>
</>
);
}
export default MainPage;