mirror of https://github.com/docker/docs.git
Use new /logout endpoint
Signed-off-by: Jeffrey Morgan <jmorganca@gmail.com>
This commit is contained in:
parent
bcfcd6bc70
commit
b31858bb6d
|
|
@ -48,6 +48,15 @@ class AccountStore {
|
|||
this.setState({username, verified, errors: {}, loading: false});
|
||||
}
|
||||
|
||||
loggedout () {
|
||||
this.setState({
|
||||
loading: false,
|
||||
errors: {},
|
||||
username: null,
|
||||
verified: false
|
||||
});
|
||||
}
|
||||
|
||||
signedup ({username}) {
|
||||
this.setState({username, errors: {}, loading: false});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -95,6 +95,10 @@ module.exports = {
|
|||
localStorage.removeItem('auth.username');
|
||||
localStorage.removeItem('auth.verified');
|
||||
localStorage.removeItem('auth.config');
|
||||
|
||||
this.request({
|
||||
url: `${HUB2_ENDPOINT}/logout`
|
||||
}, (error, response, body) => {});
|
||||
},
|
||||
|
||||
login: function (username, password, callback) {
|
||||
|
|
|
|||
|
|
@ -131,6 +131,13 @@ module.exports = {
|
|||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
if (orgResponse.statusCode === 401) {
|
||||
hubUtil.logout();
|
||||
repositoryServerActions.reposUpdated({repos: []});
|
||||
return;
|
||||
}
|
||||
|
||||
if (orgResponse.statusCode !== 200) {
|
||||
let generalError = new Error('Failed to fetch repos');
|
||||
repositoryServerActions.error({error: generalError});
|
||||
|
|
@ -166,6 +173,12 @@ module.exports = {
|
|||
return null;
|
||||
}
|
||||
|
||||
if (orgResponse.statusCode === 401) {
|
||||
hubUtil.logout();
|
||||
repositoryServerActions.reposUpdated({repos: []});
|
||||
return;
|
||||
}
|
||||
|
||||
if (response.statusCode !== 200) {
|
||||
repositoryServerActions.error({error: new Error('Could not fetch repository information from Docker Hub.')});
|
||||
return null;
|
||||
|
|
|
|||
Loading…
Reference in New Issue