mirror of
https://github.com/Telecominfraproject/wlan-cloud-ui.git
synced 2025-11-01 19:27:51 +00:00
33 lines
740 B
JavaScript
33 lines
740 B
JavaScript
import React from 'react';
|
|
import PropTypes from 'prop-types';
|
|
import { useLocation } from 'react-router-dom';
|
|
import { useApolloClient } from '@apollo/react-hooks';
|
|
|
|
import { AppLayout as Layout } from 'wlan-cloud-ui-library';
|
|
|
|
import { AUTH_TOKEN } from 'constants/index';
|
|
|
|
import { removeItem } from 'utils/localStorage';
|
|
|
|
const MasterLayout = ({ children }) => {
|
|
const client = useApolloClient();
|
|
const location = useLocation();
|
|
|
|
const handleLogout = () => {
|
|
removeItem(AUTH_TOKEN);
|
|
client.resetStore();
|
|
};
|
|
|
|
return (
|
|
<Layout onLogout={handleLogout} locationState={location}>
|
|
{children}
|
|
</Layout>
|
|
);
|
|
};
|
|
|
|
MasterLayout.propTypes = {
|
|
children: PropTypes.node.isRequired,
|
|
};
|
|
|
|
export default MasterLayout;
|