2020-09-12 21:53:41 +00:00
|
|
|
import React, { useContext, useEffect } from 'react';
|
|
|
|
import { useRouter } from 'next/router';
|
|
|
|
import Container from 'components/Container';
|
|
|
|
import Card from 'react-bootstrap/Card';
|
|
|
|
import Button from 'react-bootstrap/Button';
|
2020-09-13 06:30:07 +00:00
|
|
|
import { clearData } from 'utils/storage/localStorage';
|
|
|
|
import { clearKeys, getKey, SESSION_KEYS } from 'utils/storage/sessionStorage';
|
2020-09-12 21:53:41 +00:00
|
|
|
|
|
|
|
export default function Gallery() {
|
|
|
|
const router = useRouter();
|
|
|
|
|
|
|
|
useEffect(() => {
|
2020-09-13 06:30:07 +00:00
|
|
|
const key = getKey(SESSION_KEYS.ENCRYPTION_KEY);
|
|
|
|
if (!key) {
|
2020-09-12 21:53:41 +00:00
|
|
|
router.push("/");
|
|
|
|
}
|
|
|
|
}, []);
|
|
|
|
|
|
|
|
const logout = () => {
|
2020-09-13 06:30:07 +00:00
|
|
|
clearKeys();
|
2020-09-12 21:53:41 +00:00
|
|
|
clearData();
|
|
|
|
router.push('/');
|
|
|
|
}
|
|
|
|
|
|
|
|
return (<Container>
|
|
|
|
<Card className="text-center">
|
|
|
|
<Card.Body>
|
|
|
|
Imagine a very nice and secure gallery of your memories here.<br/>
|
|
|
|
<br/>
|
|
|
|
<Button block onClick={logout}>Logout</Button>
|
|
|
|
</Card.Body>
|
|
|
|
</Card>
|
|
|
|
</Container>);
|
|
|
|
}
|