@@ -63,17 +63,6 @@ function useAuthentication({
6363 }
6464 } , [ authentication , loadAuthentication , update ] ) ;
6565
66- const onSubmit = useCallback ( async ( {
67- username, password, remember,
68- } ) => {
69- if ( authentication ) {
70- logout ( ) ;
71- update ( ) ;
72- } else {
73- await onSubmitLogin ( { username, password, remember } ) ;
74- }
75- } , [ authentication , config , logout , update , onSubmitLogin ] ) ;
76-
7766 const onSubmitLogin = useCallback ( async ( {
7867 username, password, remember,
7968 } ) => {
@@ -110,6 +99,17 @@ function useAuthentication({
11099 messages . genericError , messages . networkError , messages . passwordError , messages . serverError , messages . usernameError ,
111100 ] ) ;
112101
102+ const onSubmit = useCallback ( async ( {
103+ username, password, remember,
104+ } ) => {
105+ if ( authentication ) {
106+ logout ( ) ;
107+ update ( ) ;
108+ } else {
109+ await onSubmitLogin ( { username, password, remember } ) ;
110+ }
111+ } , [ authentication , config , logout , update , onSubmitLogin ] ) ;
112+
113113 const component = useMemo ( ( ) => (
114114 config && (
115115 < LoginForm
0 commit comments