Skip to content

Commit

Permalink
WIP: shows we can fetch from a REST API, capture the skill label itse…
Browse files Browse the repository at this point in the history
…lf. PUTing should be trival, need to nexct focus on abstracting away the fetch, pull urls and making a service that interacts with the dispatcher.
  • Loading branch information
robinsonkwame committed Apr 26, 2018
1 parent d38a6a0 commit 0871cdb
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/app/skill-labeller/label-display/labeller.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,19 +48,35 @@ export class LabellerComponent implements OnInit {
transitionState = 'default';
isHidden = false;
possibleSkill: string;
skill_label: boolean;
get_url: string;

ngOnInit() {
this.possibleSkill = this.labelsService.getRandomLabel();
}

onSwipe(transitionState: string, $event) {
this.get_url = 'https://jsonplaceholder.typicode.com/posts/1';
this.transitionState = transitionState;
this.skill_label = false;
if(this.transitionState == 'right'){
this.skill_label = true;
}

console.log("\t Whoa we swiped/clicked!")
console.log("\n this is the label " + this.skill_label)

setTimeout(() => {
this.isHidden = true;
setTimeout(() => {
this.isHidden = false;
this.transitionState = 'default';
this.possibleSkill = this.labelsService.getRandomLabel();
console.log("\t url is:" + this.get_url)
// Simulate GET from `dispatcher` service
fetch(this.get_url)
.then(response => response.json())
.then(json => console.log(json));
}, 500);
}, 500);
}
Expand Down

0 comments on commit 0871cdb

Please sign in to comment.