-
-
Notifications
You must be signed in to change notification settings - Fork 177
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1372 from cboard-org/chore/modernize-form-components
Chore/modernize form components
- Loading branch information
Showing
12 changed files
with
526 additions
and
592 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,48 +1,44 @@ | ||
import React, { Fragment, PureComponent } from 'react'; | ||
import React, { useState, useEffect } from 'react'; | ||
import { Link } from 'react-router-dom'; | ||
import { activate } from './Activate.actions'; | ||
import './Activate.css'; | ||
|
||
class ActivateContainer extends PureComponent { | ||
state = { | ||
isActivating: false, | ||
activationStatus: {} | ||
}; | ||
|
||
componentDidMount() { | ||
const { | ||
match: { | ||
params: { url } | ||
} | ||
} = this.props; | ||
function ActivateContainer({ | ||
match: { | ||
params: { url } | ||
} | ||
}) { | ||
const [isActivating, setIsActivating] = useState(false); | ||
const [activationStatus, setActivationStatus] = useState({}); | ||
|
||
this.setState({ isActivating: true }); | ||
useEffect( | ||
() => { | ||
setIsActivating(true); | ||
|
||
activate(url) | ||
.then(activationStatus => this.setState({ activationStatus })) | ||
.catch(activationStatus => this.setState({ activationStatus })) | ||
.finally(() => this.setState({ isActivating: false })); | ||
} | ||
activate(url) | ||
.then(response => setActivationStatus(response)) | ||
.catch(error => setActivationStatus(error)) | ||
.finally(() => setIsActivating(false)); | ||
}, | ||
// eslint-disable-next-line react-hooks/exhaustive-deps | ||
[] | ||
); | ||
|
||
render() { | ||
const { isActivating, activationStatus } = this.state; | ||
return ( | ||
<div className="Activate"> | ||
{isActivating ? ( | ||
'Activating your account...' | ||
) : ( | ||
<> | ||
<div>{activationStatus.message}</div> | ||
|
||
return ( | ||
<div className="Activate"> | ||
{isActivating ? ( | ||
'Activating your account...' | ||
) : ( | ||
<Fragment> | ||
{activationStatus.message} | ||
<br /> | ||
<Link to="/" className="Activate_home"> | ||
Home page | ||
</Link> | ||
</Fragment> | ||
)} | ||
</div> | ||
); | ||
} | ||
<Link to="/" className="Activate_home"> | ||
Home page | ||
</Link> | ||
</> | ||
)} | ||
</div> | ||
); | ||
} | ||
|
||
export default ActivateContainer; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.