properly sets user to null when logged out

This commit is contained in:
James
2020-10-03 11:20:35 -04:00
parent eccb4383a1
commit 3dbf9ac27c
3 changed files with 8 additions and 5 deletions

View File

@@ -51,6 +51,7 @@ const AuthenticationProvider = ({ children }) => {
const json = await request.json();
setUser(json.user);
} else {
setUser(null);
history.push(`${admin}/logout-inactivity`);
}
}, 1000);
@@ -138,6 +139,7 @@ const AuthenticationProvider = ({ children }) => {
if (remainingTime > 0) {
forceLogOut = setTimeout(() => {
setUser(null);
history.push(`${admin}/logout`);
closeAllModals();
}, remainingTime * 1000);

View File

@@ -27,10 +27,11 @@ module.exports = (config) => {
{
test: /\.js$/,
exclude: /node_modules\/(?!(@payloadcms\/payload)\/).*/,
use: [{
loader: 'babel-loader',
options: babelConfig,
},
use: [
{
loader: 'babel-loader',
options: babelConfig,
},
// {
// loader: 'eslint-loader',
// options: {