|
@@ -1,6 +1,7 @@
|
|
|
import { Component } from '@angular/core';
|
|
|
import { IonicPage, NavController, NavParams } from 'ionic-angular';
|
|
|
import { FormBuilder, Validators, FormGroup } from '@angular/forms';
|
|
|
+import { TwitterApiProvider } from '../../providers/twitter-api/twitter-api';
|
|
|
|
|
|
/**
|
|
|
* Generated class for the WriteTweetPage page.
|
|
@@ -21,7 +22,8 @@ export class WriteTweetPage {
|
|
|
constructor(
|
|
|
public navCtrl: NavController,
|
|
|
public navParams: NavParams,
|
|
|
- private formBuilder: FormBuilder
|
|
|
+ private formBuilder: FormBuilder,
|
|
|
+ private twitter: TwitterApiProvider
|
|
|
) {
|
|
|
this.tweet = this.formBuilder.group({
|
|
|
text: ['', Validators.maxLength(140)]
|
|
@@ -39,8 +41,9 @@ export class WriteTweetPage {
|
|
|
return progress * circumference;
|
|
|
}
|
|
|
|
|
|
- logForm() {
|
|
|
- console.log(this.tweet);
|
|
|
+ submitTweet() {
|
|
|
+ // Todo: navigate to user timeline after successfully post the tweet + handle error
|
|
|
+ this.twitter.tweet(this.tweet.value["text"]);
|
|
|
}
|
|
|
|
|
|
}
|