wangfukang 3 weeks ago
parent
commit
ffa6bb04fc
  1. 13
      pages/login/login.vue

13
pages/login/login.vue

@ -187,7 +187,7 @@
}, },
getRegistrationID(options = {}) { getRegistrationID(options = {}) {
const cachedClientId = this.getStoredClientId(); const cachedClientId = this.getStoredClientId();
if (cachedClientId) { if (!options.force && cachedClientId) {
return Promise.resolve(cachedClientId); return Promise.resolve(cachedClientId);
} }
@ -199,8 +199,10 @@
if (isResolved) return; if (isResolved) return;
isResolved = true; isResolved = true;
if (timer) clearTimeout(timer); if (timer) clearTimeout(timer);
this.saveClientId(clientId); if (clientId) {
resolve(clientId || this.getStoredClientId()); this.saveClientId(clientId);
}
resolve(clientId || (options.force ? '' : this.getStoredClientId()));
}; };
timer = setTimeout(() => { timer = setTimeout(() => {
finish(''); finish('');
@ -441,10 +443,11 @@
let clientId = '' let clientId = ''
try { try {
clientId = await this.getRegistrationID({ clientId = await this.getRegistrationID({
timeout: 800 force: true,
timeout: 2000
}); });
} catch (e) { } catch (e) {
clientId = this.getStoredClientId() clientId = ''
} }
let url; let url;
let data; let data;

Loading…
Cancel
Save