This commit is contained in:
parent
d200a1a695
commit
840a88bdc1
|
@ -27,8 +27,6 @@ module.exports = Self => {
|
||||||
|
|
||||||
const accessTokenConfig = await models.AccessTokenConfig.findOne({fields: ['renewPeriod']});
|
const accessTokenConfig = await models.AccessTokenConfig.findOne({fields: ['renewPeriod']});
|
||||||
|
|
||||||
console.log(userId, created, now, differenceMilliseconds, differenceSeconds, accessTokenConfig.renewPeriod, differenceSeconds <= accessTokenConfig.renewPeriod);
|
|
||||||
|
|
||||||
if (differenceSeconds <= accessTokenConfig.renewPeriod)
|
if (differenceSeconds <= accessTokenConfig.renewPeriod)
|
||||||
throw new UserError(`The renew period has not been exceeded`);
|
throw new UserError(`The renew period has not been exceeded`);
|
||||||
|
|
||||||
|
|
|
@ -49,7 +49,6 @@ export class Layout extends Component {
|
||||||
const differenceMilliseconds = now - new Date(this.vnToken.created);
|
const differenceMilliseconds = now - new Date(this.vnToken.created);
|
||||||
const differenceSeconds = Math.floor(differenceMilliseconds / 1000);
|
const differenceSeconds = Math.floor(differenceMilliseconds / 1000);
|
||||||
|
|
||||||
console.log(this.vnToken.created, now, differenceMilliseconds, differenceSeconds, this.renewPeriod, differenceSeconds > this.renewPeriod);
|
|
||||||
if (differenceSeconds > this.renewPeriod) {
|
if (differenceSeconds > this.renewPeriod) {
|
||||||
this.$http.post('VnUsers/renewToken')
|
this.$http.post('VnUsers/renewToken')
|
||||||
.then(json => {
|
.then(json => {
|
||||||
|
@ -59,6 +58,10 @@ export class Layout extends Component {
|
||||||
|
|
||||||
this.vnToken.set(json.data.token, json.data.created, remember);
|
this.vnToken.set(json.data.token, json.data.created, remember);
|
||||||
}
|
}
|
||||||
|
})
|
||||||
|
.catch(err => {
|
||||||
|
if (err.status != 400)
|
||||||
|
throw err;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue