Skip to content

Commit 013a4ce

Browse files
committed
refactoring
1 parent 62e3338 commit 013a4ce

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

src/FsTweet.Web/Social.fs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,7 @@ module Persistence =
4848
s.FollowingUserId = userId)
4949
} |> Seq.tryHeadAsync |> AR.catch
5050

51-
match relationship with
52-
| Some _ -> return true
53-
| _ -> return false
51+
return relationship.IsSome
5452
}
5553

5654
module GetStream =

src/FsTweet.Web/assets/js/social.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,16 @@ $(function(){
22
$("#follow").on('click', function(){
33
var $this = $(this);
44
var userId = $this.data('user-id');
5-
$this.prop('disabled', true);
65
$.ajax({
76
url : "/follow",
87
type: "post",
98
data: JSON.stringify({userId : userId}),
109
contentType: "application/json"
1110
}).done(function(){
1211
alert("successfully followed");
13-
$this.prop('disabled', false);
12+
$this.attr('id', 'unfollow');
13+
$this.html('Following');
14+
$this.addClass('disabled');
1415
}).fail(function(jqXHR, textStatus, errorThrown) {
1516
console.log({jqXHR : jqXHR, textStatus : textStatus, errorThrown: errorThrown})
1617
alert("something went wrong!")

0 commit comments

Comments
 (0)