mirror of
https://gitee.com/mafgwo/stackedit
synced 2024-11-16 11:42:23 +08:00
Fixed account name problem
This commit is contained in:
parent
dd336fab3f
commit
9a220790ef
|
@ -168,17 +168,21 @@ export default {
|
|||
}))
|
||||
// Call the user info endpoint
|
||||
.then(token => this.getUser(token.sub)
|
||||
.catch(() => {
|
||||
store.dispatch('notification/info', 'Please activate Google Plus to change your account name!');
|
||||
.catch((err) => {
|
||||
if (err.status === 404) {
|
||||
store.dispatch('notification/info', 'Please activate Google Plus to change your account name!');
|
||||
} else {
|
||||
throw err;
|
||||
}
|
||||
})
|
||||
.then((user = {}) => {
|
||||
// Add name to token
|
||||
token.name = user.displayName || 'Unknown';
|
||||
const existingToken = store.getters['data/googleTokens'][token.sub];
|
||||
// Add name to token
|
||||
token.name = user.displayName || (existingToken && existingToken.name) || 'Unknown';
|
||||
if (existingToken) {
|
||||
// We probably retrieved a new token with restricted scopes.
|
||||
// That's no problem, token will be refreshed later with merged scopes.
|
||||
// Save flags
|
||||
// Restore flags
|
||||
token.isLogin = existingToken.isLogin || token.isLogin;
|
||||
token.isSponsor = existingToken.isSponsor;
|
||||
token.isDrive = existingToken.isDrive || token.isDrive;
|
||||
|
|
Loading…
Reference in New Issue
Block a user