fix: linting errors

This commit is contained in:
AlphaNecron 2021-10-15 15:17:10 +07:00
parent 5b561cd51b
commit 64c174133a
3 changed files with 51 additions and 69 deletions

File diff suppressed because one or more lines are too long

View File

@ -1,51 +1,32 @@
import { Button, Center, Heading, VStack } from '@chakra-ui/react';
import React from 'react';
import { errors } from 'lib/constants';
import Head from 'next/head';
import Link from 'next/link';
import React from 'react';
import { ArrowLeftCircle } from 'react-feather';
export default function Error({ code }) {
const errors = {
'400': 'Bad Request',
'401': 'Unauthorized',
'402': 'Payment Required',
'403': 'Forbidden',
'404': 'Not Found',
'405': 'Method Not Allowed',
'406': 'Not Acceptable',
'407': 'Proxy Authentication Required',
'408': 'Request Timeout',
'409': 'Conflict',
'410': 'Gone',
'411': 'Length Required',
'412': 'Precondition Required',
'413': 'Request Entry Too Large',
'414': 'Request-URI Too Long',
'415': 'Unsupported Media Type',
'416': 'Requested Range Not Satisfiable',
'417': 'Expectation Failed',
'418': 'I\'m a teapot',
'429': 'Too Many Requests',
'500': 'Internal Server Error',
'501': 'Not Implemented',
'502': 'Bad Gateway',
'503': 'Service Unavailable',
'504': 'Gateway Timeout',
'505': 'HTTP Version Not Supported'
};
this.title = `${code} ${errors[String(code)]}`
export default function Error({ title }) {
return (
<Center h='100vh'>
<VStack>
<Heading>{code} {errors[String(code)]}</Heading>
<Link href='/dash' passHref>
<Button justifyContent='flex-start' colorScheme='purple' leftIcon={<ArrowLeftCircle/>}>Go back</Button>
</Link>
</VStack>
</Center>
<>
<Head>
<title>{title}</title>
<meta property='og:title' content={title}/>
<meta property='theme-color' content='#FC8181'/>
</Head>
<Center h='100vh'>
<VStack>
<Heading>{title}</Heading>
<Link href='/dash' passHref>
<Button justifyContent='flex-start' colorScheme='purple' leftIcon={<ArrowLeftCircle/>}>Go back</Button>
</Link>
</VStack>
</Center>
</>
);
}
Error.getInitialProps = ({ res, err }) => {
const code = res ? res.statusCode : err ? err.statusCode : 404;
return { code };
const title = `${code} ${errors[String(code)]}`;
return { title };
};

View File

@ -11,6 +11,7 @@ export default function Index() {
<Head>
<meta property='og:title' content='Void'/>
<meta property='og:description' content='Free and open source file hosting service.'/>
<meta property='theme-color' content='#B794F4'/>
</Head>
);
}