6894 |
stevensc |
1 |
import React, { useState, useEffect } from 'react'
|
|
|
2 |
import { camalize } from '../../utils'
|
|
|
3 |
import { useParams } from 'react-router-dom'
|
|
|
4 |
import { useDispatch } from 'react-redux'
|
|
|
5 |
import { getBackendVars } from '../../services/backendVars'
|
|
|
6 |
import { addNotification } from '../../redux/notification/notification.actions'
|
|
|
7 |
|
|
|
8 |
import Overview from '../../components/overview/Overview'
|
|
|
9 |
import GroupActions from '../../components/group/GroupActions'
|
|
|
10 |
|
|
|
11 |
import './styles/linkedin.scss'
|
|
|
12 |
|
|
|
13 |
// import Accessibility from '../components/accessibility/Accessibility'
|
|
|
14 |
// import Industry from '../components/industry/Industry'
|
|
|
15 |
// import Privacy from '../components/privacy/Privacy'
|
|
|
16 |
// import Type from '../components/type/Type'
|
|
|
17 |
// import Website from '../components/website/Website'
|
|
|
18 |
|
|
|
19 |
const Edit = () => {
|
|
|
20 |
const [backendVars, setBackendVars] = useState({})
|
|
|
21 |
const dispatch = useDispatch()
|
|
|
22 |
const { uuid } = useParams()
|
|
|
23 |
|
|
|
24 |
useEffect(() => {
|
|
|
25 |
getBackendVars(`/profile/my-profiles/edit/${uuid}}`)
|
|
|
26 |
.then((vars) => {
|
|
|
27 |
const actions = {}
|
|
|
28 |
|
|
|
29 |
Object.entries(vars).forEach(([key, value]) => {
|
|
|
30 |
const camelCaseKey = camalize(key)
|
|
|
31 |
actions[camelCaseKey] = value
|
|
|
32 |
})
|
|
|
33 |
|
|
|
34 |
setBackendVars(actions)
|
|
|
35 |
console.log(actions)
|
|
|
36 |
})
|
|
|
37 |
.catch((err) => {
|
|
|
38 |
dispatch(addNotification({ style: 'danger', msg: err }))
|
|
|
39 |
console.log(`Error: ${err}`)
|
|
|
40 |
throw new Error(err)
|
|
|
41 |
})
|
|
|
42 |
}, [])
|
|
|
43 |
|
|
|
44 |
return (
|
|
|
45 |
<main className="w-100">
|
|
|
46 |
<div className="container">
|
|
|
47 |
<div className="main d-flex flex-column" style={{ gap: '1rem' }}>
|
|
|
48 |
<GroupActions {...backendVars} />
|
|
|
49 |
<Overview groupId={uuid} overview={backendVars?.overview} />
|
|
|
50 |
{/* <Type
|
|
|
51 |
groupId={groupId}
|
|
|
52 |
groupType={groupType}
|
|
|
53 |
groupTypes={groupTypes}
|
|
|
54 |
/>
|
|
|
55 |
<Industry
|
|
|
56 |
groupId={groupId}
|
|
|
57 |
industry={industry}
|
|
|
58 |
industries={industries}
|
|
|
59 |
/>
|
|
|
60 |
<Privacy
|
|
|
61 |
groupId={groupId}
|
|
|
62 |
privacy={privacy}
|
|
|
63 |
privacies={privacies}
|
|
|
64 |
setSettedPrivacy={setSettedPrivacy}
|
|
|
65 |
settedPrivacy={settedPrivacy}
|
|
|
66 |
setSettedAccesibility={setSettedAccesibility}
|
|
|
67 |
/>
|
|
|
68 |
<Accessibility
|
|
|
69 |
groupId={groupId}
|
|
|
70 |
accessibility={settedAccesibility}
|
|
|
71 |
accessibilities={accessibilities}
|
|
|
72 |
privacy={settedPrivacy}
|
|
|
73 |
setSettedAccesibility={setSettedAccesibility}
|
|
|
74 |
/>
|
|
|
75 |
<Website groupId={groupId} website={website} /> */}
|
|
|
76 |
</div>
|
|
|
77 |
</div>
|
|
|
78 |
</main>
|
|
|
79 |
)
|
|
|
80 |
}
|
|
|
81 |
|
|
|
82 |
export default Edit
|