Improved UX of user logout (#5266)
* Improved UX of user logout * Updated version & changelog * Fixed ?next='' query parameter * Updated license headermain
parent
080755a8da
commit
6acab035f2
@ -0,0 +1,32 @@
|
||||
// Copyright (C) 2022 CVAT.ai Corporation
|
||||
//
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
import Spin from 'antd/lib/spin';
|
||||
import React, { useEffect } from 'react';
|
||||
import { useDispatch } from 'react-redux';
|
||||
import { useHistory } from 'react-router';
|
||||
|
||||
import { saveLogsAsync } from 'actions/annotation-actions';
|
||||
import { logoutAsync } from 'actions/auth-actions';
|
||||
|
||||
function LogoutComponent(): JSX.Element {
|
||||
const dispatch = useDispatch();
|
||||
const history = useHistory();
|
||||
|
||||
useEffect(() => {
|
||||
dispatch(saveLogsAsync()).then(() => {
|
||||
dispatch(logoutAsync()).then(() => {
|
||||
history.goBack();
|
||||
});
|
||||
});
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<div className='cvat-logout-page cvat-spinner-container'>
|
||||
<Spin className='cvat-spinner' />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export default React.memo(LogoutComponent);
|
||||
Loading…
Reference in New Issue