11import * as React from 'react' ;
22import { useState } from 'react' ;
3- import { Agent } from '@tomic/react' ;
3+ import { Agent , useStore } from '@tomic/react' ;
44import { FaCog , FaEye , FaEyeSlash , FaUser } from 'react-icons/fa' ;
55
66import { useSettings } from '../helpers/AppSettings' ;
@@ -12,6 +12,7 @@ import {
1212import { ButtonInput , Button } from '../components/Button' ;
1313import { Margin } from '../components/Card' ;
1414import Field from '../components/forms/Field' ;
15+ import { setCookieAuthentication } from '../helpers/cookieAuthentication' ;
1516import { ResourceInline } from '../views/ResourceInline' ;
1617import { ContainerNarrow } from '../components/Containers' ;
1718import { AtomicLink } from '../components/AtomicLink' ;
@@ -28,6 +29,7 @@ const SettingsAgent: React.FunctionComponent = () => {
2829 const [ advanced , setAdvanced ] = useState ( false ) ;
2930 const [ secret , setSecret ] = useState < string | undefined > ( undefined ) ;
3031 const navigate = useNavigate ( ) ;
32+ const store = useStore ( ) ;
3133
3234 // When there is an agent, set the advanced values
3335 // Otherwise, reset the secret value
@@ -81,6 +83,7 @@ const SettingsAgent: React.FunctionComponent = () => {
8183 function setAgentIfChanged ( oldAgent : Agent | undefined , newAgent : Agent ) {
8284 if ( JSON . stringify ( oldAgent ) !== JSON . stringify ( newAgent ) ) {
8385 setAgent ( newAgent ) ;
86+ setCookieAuthentication ( store , newAgent ) ;
8487 }
8588 }
8689
0 commit comments