Handled 204 API response for logged out member session

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

The endpoint `/members/api/session/` is used by Portal for fetching member session while setting up and redirecting to Stripe Checkout flow. The status code returned by API for logged out member is changed from 4xx Unauthorized to 204 No Content, which is consistent with member API response.
This commit is contained in:
Rishabh 2021-07-30 10:29:33 +05:30
parent 7578a9cec4
commit ac33b47e7f

View File

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