Skip to content

Commit

Permalink
Merge pull request #25 from InseeFr/reactivate-redirection
Browse files Browse the repository at this point in the history
Reactivate redirection
  • Loading branch information
BettyB979 authored Feb 21, 2023
2 parents b5eff01 + 58adfab commit 9efd3ff
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 12,419 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,4 @@
npm-debug.log*
yarn-debug.log*
yarn-error.log*
yarn.lock*
2 changes: 1 addition & 1 deletion .k8s/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ spec:
spec:
containers:
- name: coleman-access
image: inseefr/coleman-access:0.10.7
image: inseefr/coleman-access:0.10.8
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "colempub",
"version": "0.10.7",
"version": "0.10.8",
"dependencies": {
"axios": "^0.19.2",
"bootstrap": "^3.3.7",
Expand Down
19 changes: 6 additions & 13 deletions src/components/auth/component.js
Original file line number Diff line number Diff line change
@@ -1,26 +1,23 @@
// import React, { useCallback, useEffect, useState } from 'react';
import React, { useCallback, useEffect, useState } from 'react';
import PropTypes from 'prop-types';
import Loading from 'components/loading/loading';
import ErrorComponent from 'components/template/error-component';
/* import { extractQuestionnaireUrl } from 'utils/url-utils';
import { extractQuestionnaireUrl } from 'utils/url-utils';
import { getSurveyVerifMailById } from 'utils/read-content';
import { getQuestionnaireUrl } from 'utils/api'; */
import { getQuestionnaireUrl } from 'utils/api';
import useAuth from 'utils/hook/auth';
import NoSurveyPage from 'components/content/ineligible';

const Auth = ({ urlBackEnd, urlMySurveys, id, history, keycloakAuth }) => {
const Auth = ({ urlBackEnd, id, history, keycloakAuth }) => {
const { loading, authenticated, authError } = useAuth(keycloakAuth);
const [error, setError] = useState(null);
// const [ineligible, setIneligible] = useState(false);

const ineligible = false;
const [ineligible, setIneligible] = useState(false);

const redirectToUrl = url => {
window.location = url;
};

/* const redirectToQuestionnaire = useCallback(async () => {
const redirectToQuestionnaire = useCallback(async () => {
try {
const response = await getQuestionnaireUrl(urlBackEnd, keycloakAuth);
if (response.data && response.data.length) {
Expand All @@ -41,11 +38,7 @@ const Auth = ({ urlBackEnd, urlMySurveys, id, history, keycloakAuth }) => {
// including 410 status - no habilitation found
setError('technique');
}
}, [history, id, urlBackEnd, keycloakAuth]); */

const redirectToQuestionnaire = useCallback(() => {
redirectToUrl(urlMySurveys);
}, [urlMySurveys]);
}, [history, id, urlBackEnd, keycloakAuth]);

useEffect(() => {
if (authenticated && !loading) redirectToQuestionnaire();
Expand Down
Loading

0 comments on commit 9efd3ff

Please sign in to comment.