From ad76c651492bc144b9fe1676e29697c5283b850a Mon Sep 17 00:00:00 2001 From: Bastien DUMONT <bdumont@grandlyon.com> Date: Wed, 9 Oct 2024 13:54:40 +0200 Subject: [PATCH] save if doesn't exists --- src/components/Connection/GRDFConnect/GrdfConnectView.tsx | 2 ++ src/components/Connection/SGEConnect/SgeConnectView.tsx | 2 ++ src/components/Connection/useForm.tsx | 2 +- 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/components/Connection/GRDFConnect/GrdfConnectView.tsx b/src/components/Connection/GRDFConnect/GrdfConnectView.tsx index c9b5e3da9..d2b6eafe2 100644 --- a/src/components/Connection/GRDFConnect/GrdfConnectView.tsx +++ b/src/components/Connection/GRDFConnect/GrdfConnectView.tsx @@ -6,6 +6,7 @@ import Header from 'components/Header/Header' import useKonnectorAuth from 'components/Hooks/useKonnectorAuth' import useUserInstanceSettings from 'components/Hooks/useUserInstanceSettings' import { useClient } from 'cozy-client' +import { FORM_DOCTYPE } from 'doctypes' import { FluidType } from 'enums' import { AccountGRDFData } from 'models' import React, { useCallback, useEffect, useRef, useState } from 'react' @@ -114,6 +115,7 @@ export const GrdfConnectView = () => { setCurrentStep(prev => prev + 1) client.save({ ...formData, + _type: FORM_DOCTYPE, firstName: grdfState.firstname, lastName: grdfState.lastname, pce: grdfState.pce, diff --git a/src/components/Connection/SGEConnect/SgeConnectView.tsx b/src/components/Connection/SGEConnect/SgeConnectView.tsx index 32dc5d065..e6290bd54 100644 --- a/src/components/Connection/SGEConnect/SgeConnectView.tsx +++ b/src/components/Connection/SGEConnect/SgeConnectView.tsx @@ -5,6 +5,7 @@ import CozyBar from 'components/Header/CozyBar' import Header from 'components/Header/Header' import useKonnectorAuth from 'components/Hooks/useKonnectorAuth' import { useClient } from 'cozy-client' +import { FORM_DOCTYPE } from 'doctypes' import { FluidType, SgeStep } from 'enums' import { SgeStore } from 'models' import React, { useCallback, useEffect, useRef, useState } from 'react' @@ -120,6 +121,7 @@ const SgeConnectView = () => { client.save({ ...formData, + _type: FORM_DOCTYPE, firstName: sgeState.firstName, lastName: sgeState.lastName, pdl: sgeState.pdl, diff --git a/src/components/Connection/useForm.tsx b/src/components/Connection/useForm.tsx index 9dd853c8c..1bf3be720 100644 --- a/src/components/Connection/useForm.tsx +++ b/src/components/Connection/useForm.tsx @@ -9,7 +9,7 @@ export type QueryParams = (arg?: any) => { options: QueryOptions } -export interface FormData { +interface FormData { firstName: string lastName: string pdl: string -- GitLab