adding in gg endpoints and basic methods
This commit is contained in:
+38
-1
@@ -16,6 +16,9 @@ import useTranslation from "next-translate/useTranslation";
|
||||
import { getIncidents } from "../actions";
|
||||
import { parseCookies } from "nookies";
|
||||
|
||||
import { getProviderConfig, getGGToken } from "../actions/govgateway";
|
||||
import { getGovGatewayConfig } from "../store/govgateway/action";
|
||||
|
||||
const Home = (props) => {
|
||||
const { footerLinks, pages, showLogin } = props;
|
||||
let { t, lang } = useTranslation();
|
||||
@@ -90,13 +93,47 @@ export const getServerSideProps = wrapper.getServerSideProps(
|
||||
(store) => async (ctx) => {
|
||||
const { query, req, res } = ctx;
|
||||
|
||||
console.log(query.code);
|
||||
|
||||
const showLoginCheck = process.env.SHOWLOGIN || false;
|
||||
const hasLoginCode = typeof query.code != "undefined";
|
||||
|
||||
console.log("Show login module: ", showLoginCheck);
|
||||
|
||||
let providerConfig = await getProviderConfig();
|
||||
|
||||
console.log(providerConfig.token_endpoint);
|
||||
|
||||
store.dispatch(getGovGatewayConfig(providerConfig));
|
||||
|
||||
if (hasLoginCode == true) {
|
||||
let ggToken = await getGGToken(
|
||||
providerConfig.token_endpoint,
|
||||
query.code,
|
||||
process.env.GG_REDIRECT_URI
|
||||
);
|
||||
console.log(ggToken);
|
||||
}
|
||||
|
||||
return {
|
||||
props: { showLogin: showLoginCheck },
|
||||
};
|
||||
}
|
||||
);
|
||||
export default Home; //connect(mapStateToProps)(Home);
|
||||
|
||||
const mapStateToProps = (state) => {
|
||||
return {
|
||||
currentView: state.currentView,
|
||||
search: state.search,
|
||||
searchResultsObj: state.searchResultsObj,
|
||||
formData: state.formData,
|
||||
appealType: state.appealType,
|
||||
form: state.form,
|
||||
myCases: state.myCases,
|
||||
watchedCases: state.watchedCases,
|
||||
myRepresentations: state.myRepresentations,
|
||||
awaitingSubmission: state.awaitingSubmission,
|
||||
govGateway: state.govGateway,
|
||||
};
|
||||
};
|
||||
export default connect(mapStateToProps)(Home);
|
||||
|
||||
Reference in New Issue
Block a user