Commit a9fd813b authored by Zéfling's avatar Zéfling 🎨
Browse files

Fix tweets with the new Json structure

parent 34e68350
......@@ -108,6 +108,8 @@ export interface Tweet {
user_name: string;
html_text: string;
retweet: boolean;
// after 2020
tweet: Tweet;
}
export class TweetsCalendar {
......
......@@ -58,7 +58,7 @@
padding: 1px;
margin: 1px;
display: flex;
align-items: end;
align-items: flex-end;
background-color: var(--item-bd-empty-color);
transition: background-color .4s;
......
......@@ -54,6 +54,14 @@ export class TweetsService {
try {
this.tweetsData.tweets = JSON.parse(data.replace(pattern.win, ''));
this.tweetsData.init = true;
// since 2020-01
if (this.tweetsData.tweets[0] && this.tweetsData.tweets[0].tweet) {
const l = this.tweetsData.tweets.length;
for (let i = 0; i < l; i++) {
this.tweetsData.tweets[i] = this.tweetsData.tweets[i].tweet;
}
}
this.onData.next();
} catch (e) {
this.tweetsData.error = true;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment