|
@@ -1,4 +1,5 @@
|
|
|
import { Component, Input } from "@angular/core";
|
|
|
+import { TwitterApiProvider } from "../../providers/twitter-api/twitter-api";
|
|
|
|
|
|
/**
|
|
|
* Generated class for the ProfileHeaderComponent component.
|
|
@@ -14,7 +15,7 @@ export class ProfileHeaderComponent {
|
|
|
@Input()
|
|
|
user: any;
|
|
|
|
|
|
- constructor() {}
|
|
|
+ constructor(private twitter: TwitterApiProvider) {}
|
|
|
|
|
|
get banner() {
|
|
|
if (this.user.profile_banner_url) {
|
|
@@ -23,4 +24,14 @@ export class ProfileHeaderComponent {
|
|
|
return this.user.profile_background_image_url_https;
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ async follow(userId) {
|
|
|
+ await this.twitter.createFriendship(userId);
|
|
|
+ this.user.following = true;
|
|
|
+ }
|
|
|
+
|
|
|
+ async unfollow(userId) {
|
|
|
+ await this.twitter.destroyFriendship(userId);
|
|
|
+ this.user.following = false;
|
|
|
+ }
|
|
|
}
|