Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Ecolyo
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
web-et-numerique
Factory
LLLE_Project
Ecolyo
Commits
78d0f745
Commit
78d0f745
authored
Mar 28, 2024
by
Bastien DUMONT
Browse files
Options
Downloads
Patches
Plain Diff
Revert "chore: remove unused error from custom hook"
This reverts commit
f87dbc11
.
parent
4fbc1a62
No related branches found
No related tags found
2 merge requests
!1154
feat: GRDF consent email
,
!1137
feat(grdf)!: update error messages
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/components/Connection/EPGLConnect/EpglForm.tsx
+5
-1
5 additions, 1 deletion
src/components/Connection/EPGLConnect/EpglForm.tsx
src/components/Hooks/useKonnectorAuth.tsx
+7
-2
7 additions, 2 deletions
src/components/Hooks/useKonnectorAuth.tsx
src/locales/fr.json
+1
-0
1 addition, 0 deletions
src/locales/fr.json
with
13 additions
and
3 deletions
src/components/Connection/EPGLConnect/EpglForm.tsx
+
5
−
1
View file @
78d0f745
...
@@ -29,7 +29,7 @@ const EpglForm = ({ hasCreatedAccount }: { hasCreatedAccount: boolean }) => {
...
@@ -29,7 +29,7 @@ const EpglForm = ({ hasCreatedAccount }: { hasCreatedAccount: boolean }) => {
const
[
loading
,
setLoading
]
=
useState
<
boolean
>
(
false
)
const
[
loading
,
setLoading
]
=
useState
<
boolean
>
(
false
)
const
[
showPassword
,
setShowPassword
]
=
useState
(
false
)
const
[
showPassword
,
setShowPassword
]
=
useState
(
false
)
const
[
connect
,
update
]
=
useKonnectorAuth
(
FluidType
.
WATER
,
{
const
[
connect
,
update
,
connectError
]
=
useKonnectorAuth
(
FluidType
.
WATER
,
{
eglAuthData
:
{
login
,
password
},
eglAuthData
:
{
login
,
password
},
})
})
...
@@ -67,6 +67,10 @@ const EpglForm = ({ hasCreatedAccount }: { hasCreatedAccount: boolean }) => {
...
@@ -67,6 +67,10 @@ const EpglForm = ({ hasCreatedAccount }: { hasCreatedAccount: boolean }) => {
}
}
}
}
useEffect
(()
=>
{
if
(
connectError
)
setError
(
connectError
)
},
[
connectError
])
useEffect
(()
=>
{
useEffect
(()
=>
{
if
(
account
?.
auth
)
{
if
(
account
?.
auth
)
{
const
auth
=
account
.
auth
const
auth
=
account
.
auth
...
...
...
...
This diff is collapsed.
Click to expand it.
src/components/Hooks/useKonnectorAuth.tsx
+
7
−
2
View file @
78d0f745
import
*
as
Sentry
from
'
@sentry/react
'
import
*
as
Sentry
from
'
@sentry/react
'
import
{
useClient
}
from
'
cozy-client
'
import
{
useClient
}
from
'
cozy-client
'
import
{
useI18n
}
from
'
cozy-ui/transpiled/react/I18n
'
import
{
FluidType
}
from
'
enums
'
import
{
FluidType
}
from
'
enums
'
import
{
import
{
AccountEGLData
,
AccountEGLData
,
...
@@ -8,6 +9,7 @@ import {
...
@@ -8,6 +9,7 @@ import {
FluidConnection
,
FluidConnection
,
SgeStore
,
SgeStore
,
}
from
'
models
'
}
from
'
models
'
import
{
useState
}
from
'
react
'
import
AccountService
from
'
services/account.service
'
import
AccountService
from
'
services/account.service
'
import
ConnectionService
from
'
services/connection.service
'
import
ConnectionService
from
'
services/connection.service
'
import
{
updateFluidConnection
}
from
'
store/global/global.slice
'
import
{
updateFluidConnection
}
from
'
store/global/global.slice
'
...
@@ -64,12 +66,14 @@ const useKonnectorAuth = (
...
@@ -64,12 +66,14 @@ const useKonnectorAuth = (
sgeAuthData
?:
SgeStore
sgeAuthData
?:
SgeStore
grdfAuthData
?:
AccountGRDFData
grdfAuthData
?:
AccountGRDFData
}
}
):
[()
=>
Promise
<
null
|
undefined
>
,
()
=>
Promise
<
void
>
]
=>
{
):
[()
=>
Promise
<
null
|
undefined
>
,
()
=>
Promise
<
void
>
,
string
]
=>
{
const
client
=
useClient
()
const
client
=
useClient
()
const
{
t
}
=
useI18n
()
const
dispatch
=
useAppDispatch
()
const
dispatch
=
useAppDispatch
()
const
{
fluidStatus
}
=
useAppSelector
(
state
=>
state
.
ecolyo
.
global
)
const
{
fluidStatus
}
=
useAppSelector
(
state
=>
state
.
ecolyo
.
global
)
const
currentFluidStatus
=
fluidStatus
[
fluidType
]
const
currentFluidStatus
=
fluidStatus
[
fluidType
]
const
konnectorSlug
=
currentFluidStatus
.
connection
.
konnectorConfig
.
slug
const
konnectorSlug
=
currentFluidStatus
.
connection
.
konnectorConfig
.
slug
const
[
connectError
,
setConnectError
]
=
useState
<
string
>
(
''
)
const
connect
=
async
()
=>
{
const
connect
=
async
()
=>
{
try
{
try
{
...
@@ -88,6 +92,7 @@ const useKonnectorAuth = (
...
@@ -88,6 +92,7 @@ const useKonnectorAuth = (
)
)
if
(
!
trigger
||
!
account
)
{
if
(
!
trigger
||
!
account
)
{
setConnectError
(
t
(
'
konnector_form.error_account_creation
'
))
return
null
return
null
}
}
const
updatedConnection
:
FluidConnection
=
{
const
updatedConnection
:
FluidConnection
=
{
...
@@ -142,7 +147,7 @@ const useKonnectorAuth = (
...
@@ -142,7 +147,7 @@ const useKonnectorAuth = (
Sentry
.
captureException
(
error
)
Sentry
.
captureException
(
error
)
}
}
}
}
return
[
connect
,
update
]
return
[
connect
,
update
,
connectError
]
}
}
export
default
useKonnectorAuth
export
default
useKonnectorAuth
This diff is collapsed.
Click to expand it.
src/locales/fr.json
+
1
−
0
View file @
78d0f745
...
@@ -760,6 +760,7 @@
...
@@ -760,6 +760,7 @@
"login_failed"
:
"Un problème a lieu lors de la récupération de vos données. Merci de supprimer votre connecteur et vous reconnecter."
,
"login_failed"
:
"Un problème a lieu lors de la récupération de vos données. Merci de supprimer votre connecteur et vous reconnecter."
,
"not_installed"
:
"Le connecteur n'est pas installé. Veuillez l'installer en cliquant sur le bouton ci-dessous."
,
"not_installed"
:
"Le connecteur n'est pas installé. Veuillez l'installer en cliquant sur le bouton ci-dessous."
,
"button_install"
:
"Installer"
,
"button_install"
:
"Installer"
,
"error_account_creation"
:
"Une erreur est survenue, veuillez essayer de nouveau."
,
"error_no_login_password"
:
"Identifiant et mot de passe requis"
,
"error_no_login_password"
:
"Identifiant et mot de passe requis"
,
"error_login_failed"
:
"Identifiants invalides"
,
"error_login_failed"
:
"Identifiants invalides"
,
"error_update"
:
"Un problème est survenu lors du rapatriement de vos données."
,
"error_update"
:
"Un problème est survenu lors du rapatriement de vos données."
,
...
...
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
sign in
to comment