Skip to content

Commit

Permalink
fix sending tweets
Browse files Browse the repository at this point in the history
  • Loading branch information
jeffmendoza committed Jan 26, 2015
1 parent f3103fb commit 4aa6b93
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 7 deletions.
22 changes: 17 additions & 5 deletions client/chromeapp/app/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,26 @@ angular
return dfd.promise;
},
fetch: get,
sendTweet: function(text) {
sendTweet: function(text) {
console.log(text)
get().then(function(settings) {
// TODO - Server should allow CORS
return $http.post(settings.server + '/tweet', {
// return $http.post(settings.server + '/tweet', {
// headers: {
// 'Authorization': 'Basic ' + window.btoa(settings.username + ':' + settings.password)
// },
// data: {
// "tweet": text
// }
// })
return $http({
method: 'POST',
url: settings.server + '/tweet',
headers: {
'Authorization': 'Basic ' + window.btoa(settings.username + ':' + settings.password)
},
data: {
tweet: tweet
"tweet": text
}
})
});
Expand Down Expand Up @@ -128,7 +139,7 @@ angular
for (var i = 0; i < data.length - 1; i += 2) {
result.push({
user: personStr,
timestamp: new Date(parseInt(data[i], 10)),
timestamp: new Date(parseInt(data[i], 10) * 1000),
tweet: data[i + 1]
});
}
Expand Down Expand Up @@ -243,6 +254,7 @@ angular

$scope.sendTweet = function(text) {
$scope.compose.hide();
Settings.sendTweet(text);
console.log(text)
Settings.sendTweet(text);
};
}]);
4 changes: 2 additions & 2 deletions client/chromeapp/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ <h1 class="title">OpenTweet</h1>
<div class="list list-inset">
<div class="list list-inset">
<label class="item item-input">
<textarea placeholder="Tweet text" rows="5" ng-modal="tweetText"/>
<textarea placeholder="Tweet text" rows="5" ng-model="tweetText"/>
</label>
<button ng-click="sendTweet(tweetText)" class="button button-full button-positive"><i class="icon ion-social-twitter"></i>
Send Tweet
Expand Down Expand Up @@ -119,4 +119,4 @@ <h1> <i class="icon ion-alert-circled"></i>
</ion-tabs>
</ion-pane>
</body>
</html>
</html>

0 comments on commit 4aa6b93

Please sign in to comment.