mirror of
https://github.com/roleypoly/roleypoly.git
synced 2025-04-25 03:49:11 +00:00
load auth login ui config from server only
This commit is contained in:
parent
4dbca37917
commit
5d17105eba
1 changed files with 12 additions and 13 deletions
|
@ -1,26 +1,25 @@
|
||||||
import { NextPageContext } from 'next';
|
import { GetServerSidePropsContext } from 'next';
|
||||||
import getConfig from 'next/config';
|
import getConfig from 'next/config';
|
||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
import { AuthLogin } from 'roleypoly/design-system/templates/auth-login';
|
import { AuthLogin } from 'roleypoly/design-system/templates/auth-login';
|
||||||
|
|
||||||
const { publicRuntimeConfig } = getConfig();
|
const loginPage = (props: { apiURI: string }) => {
|
||||||
|
|
||||||
const loginPage = (props: { apiRoot: string }) => {
|
|
||||||
const onSendSecretCode = (code: string) => {
|
|
||||||
console.log(code);
|
|
||||||
};
|
|
||||||
return (
|
return (
|
||||||
<AuthLogin
|
<AuthLogin
|
||||||
onSendSecretCode={onSendSecretCode}
|
onSendSecretCode={() => {}}
|
||||||
discordOAuthLink={`${
|
discordOAuthLink={`${props.apiURI}/login-bounce`}
|
||||||
props.apiRoot || publicRuntimeConfig.apiPublicURI
|
|
||||||
}/login-bounce`}
|
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export default loginPage;
|
export default loginPage;
|
||||||
|
|
||||||
loginPage.getInitialProps = (context: NextPageContext) => {
|
export const getServerSideProps = async (context: GetServerSidePropsContext) => {
|
||||||
return { apiRoot: publicRuntimeConfig.apiPublicURI };
|
const { publicRuntimeConfig } = getConfig();
|
||||||
|
|
||||||
|
return {
|
||||||
|
props: {
|
||||||
|
apiURI: publicRuntimeConfig.apiPublicURI,
|
||||||
|
},
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Reference in a new issue