mirror of
https://github.com/roleypoly/roleypoly.git
synced 2025-06-17 01:59:08 +00:00
finish login story
This commit is contained in:
parent
a23184efd2
commit
c9cb4c95bc
34 changed files with 14564 additions and 21666 deletions
17
src/pages/machinery/error.tsx
Normal file
17
src/pages/machinery/error.tsx
Normal file
|
@ -0,0 +1,17 @@
|
|||
import { NextPageContext } from 'next';
|
||||
import * as React from 'react';
|
||||
import { Error } from 'roleypoly/design-system/templates/errors';
|
||||
|
||||
type Props = {
|
||||
errorCode: string | number | any;
|
||||
};
|
||||
|
||||
const ErrorPage = (props: Props) => <Error code={props.errorCode} />;
|
||||
|
||||
ErrorPage.getInitialProps = (context: NextPageContext): Props => {
|
||||
return {
|
||||
errorCode: context.err || context.query.error_code,
|
||||
};
|
||||
};
|
||||
|
||||
export default ErrorPage;
|
27
src/pages/machinery/new-session.tsx
Normal file
27
src/pages/machinery/new-session.tsx
Normal file
|
@ -0,0 +1,27 @@
|
|||
import { NextPageContext } from 'next';
|
||||
import * as React from 'react';
|
||||
|
||||
type Props = {
|
||||
sessionID: string;
|
||||
};
|
||||
|
||||
const NewSession = (props: Props) => {
|
||||
const { sessionID } = props;
|
||||
React.useEffect(() => {
|
||||
sessionStorage.setItem('session_key', sessionID);
|
||||
location.href = '/';
|
||||
}, [sessionID]);
|
||||
|
||||
return <div>Logging you in...</div>;
|
||||
};
|
||||
|
||||
NewSession.getInitialProps = (context: NextPageContext): Props => {
|
||||
const sessionID = context.query.session_id;
|
||||
if (!sessionID) {
|
||||
throw new Error("I shouldn't be here today.");
|
||||
}
|
||||
|
||||
return { sessionID: sessionID as string };
|
||||
};
|
||||
|
||||
export default NewSession;
|
Loading…
Add table
Add a link
Reference in a new issue