19 行
475 B
TypeScript
19 行
475 B
TypeScript
import React, { useContext, useEffect } from 'react';
|
|
import { useNavigate } from 'react-router-dom';
|
|
import { AuthContext } from '../contexts';
|
|
import { Session } from '../services';
|
|
|
|
export const Logout: React.FC = () => {
|
|
const context = useContext(AuthContext);
|
|
const navigate = useNavigate();
|
|
|
|
useEffect(() => {
|
|
Session.reset();
|
|
context.resetAuth();
|
|
navigate('/');
|
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
}, []);
|
|
|
|
return <></>;
|
|
}
|