Skip to content
This repository has been archived by the owner on Mar 6, 2023. It is now read-only.

Commit

Permalink
feat(enquete): refresh validation after mutation (#1823)
Browse files Browse the repository at this point in the history
  • Loading branch information
remiroyc authored May 25, 2020
1 parent 559dfcc commit bea7f88
Show file tree
Hide file tree
Showing 7 changed files with 33 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@ async function enqueteMandataireIndividuelStatus(enqueteReponse) {

const informationsFormationMandataireStatus = await getValidationStatus(
enqueteReponse.enquete_reponses_agrements_formation,
informationsAgrementsMandataireSchema
informationsFormationMandataireSchema
);

const informationsAgrementsMandataireStatus = await getValidationStatus(
enqueteReponse.enquete_reponses_agrements_formation,
informationsFormationMandataireSchema
informationsAgrementsMandataireSchema
);

// TODO
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,7 @@ export const EnqueteIndividuel = props => {
return (
<MenuStepper
enqueteReponse={enquete_individuel}
enqueteId={enqueteId}
mandataireId={mandataireId}
sections={MENU_SECTIONS}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@ import { useMutation, useQuery } from "@apollo/react-hooks";
import React from "react";
import { Box } from "rebass";

import { ENQUETE_MANDATAIRE_INDIVIDUEL } from "../EnqueteIndividuel/queries";
import { EnqueteIndividuelInformationsForm } from "./EnqueteIndividuelInformationsForm";
import { UPDATE_ENQUETE_INDIVIDUEL_INFORMATIONS } from "./mutations";
import { ENQUETE_INDIVIDUEL_INFORMATIONS_MANDATAIRE } from "./queries";

export const EnqueteIndividuelInformations = props => {
const { goToNextPage, goToPrevPage, enqueteReponse } = props;
const { goToNextPage, goToPrevPage, enqueteReponse, mandataireId, enqueteId } = props;
const { enquete_reponses_informations_mandataire_id } = enqueteReponse;

const { data, loading } = useQuery(ENQUETE_INDIVIDUEL_INFORMATIONS_MANDATAIRE, {
Expand All @@ -17,6 +18,10 @@ export const EnqueteIndividuelInformations = props => {
});
const [updateEnquete] = useMutation(UPDATE_ENQUETE_INDIVIDUEL_INFORMATIONS, {
refetchQueries: [
{
query: ENQUETE_MANDATAIRE_INDIVIDUEL,
variables: { enqueteId, mandataireId }
},
{
query: ENQUETE_INDIVIDUEL_INFORMATIONS_MANDATAIRE,
variables: { id: enquete_reponses_informations_mandataire_id }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@ import { useMutation, useQuery } from "@apollo/react-hooks";
import React from "react";
import { Box } from "rebass";

import { ENQUETE_MANDATAIRE_INDIVIDUEL } from "../EnqueteIndividuel/queries";
import { EnqueteIndividuelInformationsAgrementsForm } from "./EnqueteIndividuelInformationsAgrementsForm";
import { UPDATE_ENQUETE_INFORMATIONS_AGREMENTS } from "./mutations";
import { ENQUETE_INDIVIDUEL_INFORMATIONS_AGREMENTS } from "./queries";

export const EnqueteIndividuelInformationsAgrements = props => {
const { goToNextPage, goToPrevPage, enqueteReponse } = props;
const { goToNextPage, goToPrevPage, enqueteReponse, mandataireId, enqueteId } = props;
const { enquete_reponses_informations_mandataire_id } = enqueteReponse;

const { data, loading } = useQuery(ENQUETE_INDIVIDUEL_INFORMATIONS_AGREMENTS, {
Expand All @@ -17,6 +18,10 @@ export const EnqueteIndividuelInformationsAgrements = props => {
});
const [updateEnquete] = useMutation(UPDATE_ENQUETE_INFORMATIONS_AGREMENTS, {
refetchQueries: [
{
query: ENQUETE_MANDATAIRE_INDIVIDUEL,
variables: { enqueteId, mandataireId }
},
{
query: ENQUETE_INDIVIDUEL_INFORMATIONS_AGREMENTS,
variables: { id: enquete_reponses_informations_mandataire_id }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@ import { useMutation, useQuery } from "@apollo/react-hooks";
import React from "react";
import { Box } from "rebass";

import { ENQUETE_MANDATAIRE_INDIVIDUEL } from "../EnqueteIndividuel/queries";
import { EnqueteIndividuelInformationsFormationForm } from "./EnqueteIndividuelInformationsFormationForm";
import { UPDATE_ENQUETE_INFORMATIONS_FORMATION } from "./mutations";
import { ENQUETE_INDIVIDUEL_INFORMATIONS_FORMATION } from "./queries";

export const EnqueteIndividuelInformationsFormation = props => {
const { goToNextPage, goToPrevPage, enqueteReponse } = props;
const { goToNextPage, goToPrevPage, enqueteReponse, mandataireId, enqueteId } = props;
const { enquete_reponses_agrements_formations_id } = enqueteReponse;

const { data, loading } = useQuery(ENQUETE_INDIVIDUEL_INFORMATIONS_FORMATION, {
Expand All @@ -18,6 +19,10 @@ export const EnqueteIndividuelInformationsFormation = props => {

const [updateEnquete] = useMutation(UPDATE_ENQUETE_INFORMATIONS_FORMATION, {
refetchQueries: [
{
query: ENQUETE_MANDATAIRE_INDIVIDUEL,
variables: { enqueteId, mandataireId }
},
{
query: ENQUETE_INDIVIDUEL_INFORMATIONS_FORMATION,
variables: { id: enquete_reponses_agrements_formations_id }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@ import { useMutation, useQuery } from "@apollo/react-hooks";
import React from "react";
import { Box } from "rebass";

import { ENQUETE_MANDATAIRE_INDIVIDUEL } from "../EnqueteIndividuel/queries";
import { EnqueteIndividuelPrestationsSocialesForm } from "./EnqueteIndividuelPrestationsSocialesForm";
import { UPDATE_ENQUETE_INDIVIDUEL_PRESTATIONS_SOCIALES } from "./mutations";
import { ENQUETE_REPONSE_PRESTATIONS_SOCIALES } from "./queries";

export const EnqueteIndividuelPrestationsSociales = props => {
const { goToNextPage, goToPrevPage, enqueteReponse } = props;
const { goToNextPage, goToPrevPage, enqueteReponse, mandataireId, enqueteId } = props;
const { enquete_reponses_prestations_sociale_id } = enqueteReponse;

const { data, loading } = useQuery(ENQUETE_REPONSE_PRESTATIONS_SOCIALES, {
Expand All @@ -18,6 +19,10 @@ export const EnqueteIndividuelPrestationsSociales = props => {

const [updateEnquete] = useMutation(UPDATE_ENQUETE_INDIVIDUEL_PRESTATIONS_SOCIALES, {
refetchQueries: [
{
query: ENQUETE_MANDATAIRE_INDIVIDUEL,
variables: { enqueteId, mandataireId }
},
{
query: ENQUETE_REPONSE_PRESTATIONS_SOCIALES,
variables: { id: enquete_reponses_prestations_sociale_id }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@ import React from "react";
import { useMutation, useQuery } from "react-apollo";
import { Box } from "rebass";

import { ENQUETE_MANDATAIRE_INDIVIDUEL } from "../EnqueteIndividuel/queries";
import { EnquetePopulationsForm } from "./EnquetePopulationsForm";
import { UPDATE_ENQUETE_POPULATIONS_CURATELLE } from "./mutations";
import { ENQUETE_REPONSE_POPULATIONS_CURATELLE } from "./queries";

export const EnquetePopulationsCuratelle = props => {
const { goToPrevPage, goToNextPage, enqueteReponse } = props;
const { goToPrevPage, goToNextPage, enqueteReponse, mandataireId, enqueteId } = props;
const { enquete_reponses_populations_id } = enqueteReponse;

const { data, loading } = useQuery(ENQUETE_REPONSE_POPULATIONS_CURATELLE, {
Expand All @@ -18,6 +19,10 @@ export const EnquetePopulationsCuratelle = props => {

const [updateEnquete] = useMutation(UPDATE_ENQUETE_POPULATIONS_CURATELLE, {
refetchQueries: [
{
query: ENQUETE_MANDATAIRE_INDIVIDUEL,
variables: { enqueteId, mandataireId }
},
{
query: ENQUETE_REPONSE_POPULATIONS_CURATELLE,
variables: { id: enquete_reponses_populations_id }
Expand Down

0 comments on commit bea7f88

Please sign in to comment.