|
1 | | -import React, { useState } from 'react'; |
| 1 | +import React from 'react'; |
2 | 2 | import { makeStyles } from '@material-ui/core/styles'; |
3 | 3 | import { Box, Grid, Typography, Card, Button } from '@material-ui/core'; |
4 | 4 | import DetailsBottom from './partials/DetailsBottom'; |
5 | 5 |
|
6 | | -import { login } from 'src/actions/accountActions'; |
7 | | -import axios from 'src/utils/axios'; |
8 | | -import { useDispatch, useSelector } from 'react-redux'; |
| 6 | +import ApplyModal from './ApplyModal'; |
9 | 7 |
|
10 | 8 | const useStyles = makeStyles(theme => ({ |
11 | 9 | icon: { |
@@ -89,23 +87,6 @@ const useStyles = makeStyles(theme => ({ |
89 | 87 |
|
90 | 88 | export default function FinalAction({ course, batch }) { |
91 | 89 | const classes = useStyles(); |
92 | | - const [applyState, setApplyState] = useState('Enquire'); |
93 | | - |
94 | | - const user = useSelector(state => state.account.user); |
95 | | - const baseUrl = |
96 | | - 'https://us-central1-codeforcauseorg.cloudfunctions.net/widgets/applications'; |
97 | | - const dispatch = useDispatch(); |
98 | | - const handleApply = () => { |
99 | | - const url = `${baseUrl}/${batch.courseId}`; |
100 | | - if (!user) { |
101 | | - dispatch(login()); |
102 | | - } else { |
103 | | - setApplyState('Generating...'); |
104 | | - axios.post(url).then(result => { |
105 | | - window.location.href = `/applications?id=${result.data.id}`; |
106 | | - }); |
107 | | - } |
108 | | - }; |
109 | 90 |
|
110 | 91 | return ( |
111 | 92 | <Grid container className={classes.root}> |
@@ -230,19 +211,9 @@ export default function FinalAction({ course, batch }) { |
230 | 211 | </Box> |
231 | 212 | </Box> |
232 | 213 | </Card> |
233 | | - |
234 | | - <Button |
235 | | - variant="contained" |
236 | | - color="secondary" |
237 | | - onClick={handleApply} |
238 | | - fullWidth |
239 | | - style={{ |
240 | | - marginTop: '24px', |
241 | | - textTransform: 'capitalize' |
242 | | - }} |
243 | | - > |
244 | | - {applyState} |
245 | | - </Button> |
| 214 | + |
| 215 | + <ApplyModal /> |
| 216 | + |
246 | 217 | </Box> |
247 | 218 | </Grid> |
248 | 219 | </Grid> |
|
0 commit comments