Total Complexity | 0 |
Complexity/F | 0 |
Lines of Code | 35 |
Function Count | 0 |
Duplicated Lines | 0 |
Ratio | 0 % |
Coverage | 100% |
Changes | 0 |
1 | import React from 'react'; |
||
2 | import PropTypes from 'prop-types'; |
||
3 | import { ServerForm } from './helpers/ServerForm'; |
||
4 | import { withSelectedServer } from './helpers/withSelectedServer'; |
||
5 | import { serverType } from './prop-types'; |
||
6 | |||
7 | 1 | const propTypes = { |
|
8 | editServer: PropTypes.func, |
||
9 | selectedServer: serverType, |
||
10 | history: PropTypes.shape({ |
||
11 | push: PropTypes.func, |
||
12 | }), |
||
13 | }; |
||
14 | |||
15 | 1 | export const EditServer = (ServerError) => { |
|
16 | 2 | const EditServerComp = ({ editServer, selectedServer, history: { push } }) => { |
|
17 | 2 | const handleSubmit = (serverData) => { |
|
18 | 1 | editServer(selectedServer.id, serverData); |
|
19 | 1 | push(`/server/${selectedServer.id}/list-short-urls/1`); |
|
20 | }; |
||
21 | |||
22 | 2 | return ( |
|
23 | <div className="create-server"> |
||
24 | <ServerForm initialValues={selectedServer} onSubmit={handleSubmit}> |
||
25 | <button className="btn btn-outline-primary">Save</button> |
||
26 | </ServerForm> |
||
27 | </div> |
||
28 | ); |
||
29 | }; |
||
30 | |||
31 | 2 | EditServerComp.propTypes = propTypes; |
|
32 | |||
33 | 2 | return withSelectedServer(EditServerComp, ServerError); |
|
34 | }; |
||
35 |