Fix FeedToken recreation

Closes #769

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
Thomas Citharel 2021-07-21 16:05:31 +02:00
parent 03455376d9
commit 69bc6f0390
No known key found for this signature in database
GPG Key ID: A061B9DDE0CA0773

View File

@ -484,15 +484,15 @@ export default class EditIdentity extends mixins(identityEditionMixin) {
async generateFeedTokens(): Promise<void> { async generateFeedTokens(): Promise<void> {
const newToken = await this.createNewFeedToken(); const newToken = await this.createNewFeedToken();
this.identity.feedTokens.push(newToken); this.identity.feedTokens = [...this.identity.feedTokens, newToken];
} }
async regenerateFeedTokens(): Promise<void> { async regenerateFeedTokens(): Promise<void> {
if (this.identity?.feedTokens.length < 1) return; if (this.identity?.feedTokens.length < 1) return;
await this.deleteFeedToken(this.identity.feedTokens[0].token); await this.deleteFeedToken(this.identity.feedTokens[0].token);
const newToken = await this.createNewFeedToken(); const newToken = await this.createNewFeedToken();
this.identity.feedTokens.pop(); const feedTokens = this.identity.feedTokens.slice(0, -1);
this.identity.feedTokens.push(newToken); this.identity.feedTokens = [...feedTokens, newToken];
} }
private async deleteFeedToken(token: string): Promise<void> { private async deleteFeedToken(token: string): Promise<void> {