-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
started two component remote approach
- Loading branch information
1 parent
7702987
commit 83ea373
Showing
5 changed files
with
114 additions
and
15 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
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 |
---|---|---|
@@ -0,0 +1,77 @@ | ||
import React from 'react'; | ||
import { | ||
updateRemoteCredentials, | ||
checkInputCredentials, | ||
formatState, | ||
} from '../slice'; | ||
import { useDispatch, useSelector } from 'react-redux'; | ||
|
||
const Destination = (props) => { | ||
const dispatch = useDispatch(); | ||
const { origin, destination } = useSelector((state) => state.GUI); | ||
|
||
return ( | ||
<> | ||
<h1>Destination</h1> | ||
{props.name && ( | ||
<h2> | ||
{props.name} {props.service} | ||
</h2> | ||
)} | ||
<form | ||
onSubmit={(e) => { | ||
e.preventDefault(); | ||
const accessId = e.target.accessId.value; | ||
const secretKey = e.target.secretKey.value; | ||
const accountId = e.target.accountId | ||
? e.target.accountId.value | ||
: null; | ||
const results = checkInputCredentials(accessId, secretKey); | ||
if (!results) { | ||
console.log('Credentials appear to be incorrect'); | ||
} else { | ||
const newState = formatState( | ||
results, | ||
accessId, | ||
secretKey, | ||
accountId, | ||
origin, | ||
destination | ||
); | ||
dispatch(updateRemoteCredentials(newState)); | ||
} | ||
}} | ||
> | ||
<div> | ||
{' '} | ||
<label htmlFor="accessId">Access Id:</label> | ||
{origin.accessId && props.provider === 'Origin' ? ( | ||
<p>'check'</p> | ||
) : ( | ||
<input name="accessId"></input> | ||
)} | ||
</div> | ||
<div> | ||
{' '} | ||
<label htmlFor="secretKey">Secret Key:</label> | ||
{origin.secretKey && props.provider === 'Origin' ? ( | ||
<p>'check'</p> | ||
) : ( | ||
<input name="secretKey"></input> | ||
)} | ||
</div> | ||
{props.name === 'CloudFlare' && ( | ||
<div> | ||
{' '} | ||
<label htmlFor="accountId">Account Id:</label> | ||
<input name="accountId"></input> | ||
</div> | ||
)} | ||
|
||
<button type="submit">Submit</button> | ||
</form> | ||
</> | ||
); | ||
}; | ||
|
||
export default Destination; |
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