mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-12-21 02:40:14 +01:00
* refactor(Logout): rely on hooks for mutation behavior * fix: logging out now correctly resets cache, disallowing any cache mixing between the next logged in user on the same browser * chore: remove additional localStorage values on logout
21 lines
581 B
TypeScript
21 lines
581 B
TypeScript
import { forwardRef } from 'react';
|
|
import { LogOutIcon } from '../svg';
|
|
import { useAuthContext } from '~/hooks/AuthContext';
|
|
import { useLocalize } from '~/hooks';
|
|
|
|
const Logout = forwardRef(() => {
|
|
const { logout } = useAuthContext();
|
|
const localize = useLocalize();
|
|
|
|
return (
|
|
<button
|
|
className="flex w-full cursor-pointer items-center gap-3 px-3 py-3 text-sm text-white transition-colors duration-200 hover:bg-gray-700"
|
|
onClick={() => logout()}
|
|
>
|
|
<LogOutIcon />
|
|
{localize('com_nav_log_out')}
|
|
</button>
|
|
);
|
|
});
|
|
|
|
export default Logout;
|