import React, { useState } from 'react';
import '../common/styles.css';
import '../../styles/base.scss';
import {
Box,
Button,
Flashbar,
Grid,
HelpPanel,
SpaceBetween
} from "@cloudscape-design/components";
import { Navigation } from "../common/navigation";
import { CustomAppLayout } from "../common/app-layout";
import Input from "@cloudscape-design/components/input";
import { Auth } from "aws-amplify";
import { useHistory } from "react-router-dom";
import { v4 as uuid4 } from "uuid";
export default class ConfirmSignUpView extends React.Component {
render() {
return (
}
navigationOpen={false}
content={}
contentType="default"
tools={}
toolsHide={false}
// labels={appLayoutNavigationLabels}
/>
);
}
}
export const ToolsContent = () => (
###APP_TITLE###}
footer={
<>
>
}
>
This solution demonstrates ###APP_TITLE###.
);
// The content in the main content area of the App layout
export function ConfirmSignUpContent() {
const history = useHistory();
const [user, setUser] = React.useState("");
const [code, setCode] = React.useState("");
const [notifications, setNotifications] = useState([]);
const addNotification = (message: string) => {
const list = []
for (let notification of notifications) {
list.push(notification)
}
list.push({
type: 'error',
content: message,
statusIconAriaLabel: 'error',
dismissLabel: 'Dismiss all messages',
dismissible: true,
onDismiss: () => setNotifications([]),
id: uuid4(),
});
setNotifications(list);
};
const confirmSignup = () => {
try {
Auth.confirmSignUp(user, code).then((result) => {
history.push("/Login");
}).catch(error => {
console.log("Got error in confirm signup function");
console.log(error);
addNotification("Error during confirm sign up.")
});
} catch (error) {
console.log("Got error in confirm signup function");
console.log(error);
}
}
return (
###APP_TITLE###
This solution demonstrates ###APP_TITLE###.
);
}