From f3dfaae2612c2f4d565da37d1f22251accd90ee5 Mon Sep 17 00:00:00 2001 From: James Date: Thu, 9 Jul 2020 12:37:33 -0400 Subject: [PATCH] streamlines the /me endpoint to ensure consistency --- src/auth/operations/me.js | 4 +++- src/client/components/data/User.js | 6 ++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/auth/operations/me.js b/src/auth/operations/me.js index b1e3106648..40438a22f8 100644 --- a/src/auth/operations/me.js +++ b/src/auth/operations/me.js @@ -23,7 +23,9 @@ const me = async ({ req, config }) => { return response; } - return null; + return { + user: null, + }; }; module.exports = me; diff --git a/src/client/components/data/User.js b/src/client/components/data/User.js index 81db999f24..eaf70ff95c 100644 --- a/src/client/components/data/User.js +++ b/src/client/components/data/User.js @@ -71,11 +71,9 @@ const UserProvider = ({ children }) => { if (request.status === 200) { const json = await request.json(); - if (json.user) { - setUser(json.user); - } + setUser(json?.user || null); - if (json.token) { + if (json?.token) { setToken(json.token); } }