0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-02-17 23:44:39 -05:00

💡 Handled updated API response for logged out member

refs https://github.com/TryGhost/Team/issues/560
refs 196cdafe6b

The endpoint `/members/api/member/` is used by Portal for fetching member details on site load to setup different flows. The response from this endpoint for logged out member has now changed from 401 Unauthorized to 204 No Content. This updates the API handling in Portal for updated response status.

This change also handles the visible error messages on console for Portal when it first loads and tries to establish member logged-in status, and instead handles it now behind the scenes. This also makes Portal functioning more transparent on the site.
This commit is contained in:
Rishabh 2021-05-13 15:32:32 +05:30
parent 9fcad8e31d
commit 4e14d811bf

View file

@ -57,7 +57,7 @@ function setupGhostApi({siteUrl = window.location.origin}) {
url, url,
credentials: 'same-origin' credentials: 'same-origin'
}).then(function (res) { }).then(function (res) {
if (!res.ok) { if (!res.ok || res.status === 204) {
return null; return null;
} }
return res.json(); return res.json();