-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathteam.page.ts
More file actions
72 lines (60 loc) · 1.34 KB
/
team.page.ts
File metadata and controls
72 lines (60 loc) · 1.34 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
import { Component } from '@angular/core';
import { NavController, ToastController } from 'ionic-angular';
import { TeamService } from '../../services/team.service';
// Others
import * as _ from 'lodash';
@Component({
selector: 'team-page',
templateUrl: 'team.html'
})
export class TeamPage {
members = [];
team = {};
constructor(
public navCtrl: NavController,
public teamService: TeamService,
public toastCtrl: ToastController
) {}
// @TODO: Move to shared function later...
_error(err) {
let toast = this.toastCtrl.create({
message: err,
duration: 5000,
position: 'bottom',
dismissOnPageChange: true
});
toast.onDidDismiss(() => {
console.log('Dismissed toast');
});
toast.present();
}
_pullData(refresher?) {
// @TODO Need inject user team ID
this.teamService.getTeam()
.then((result: any) => {
this.team = result.team;
this.members = result.members;
if (refresher) {
refresher.complete();
}
})
.catch((err) => {
if (refresher) {
refresher.complete();
}
this._error(err);
});
}
doRefresh(refresher) {
this._pullData(refresher);
}
ionViewWillEnter() {
this._pullData();
this.members = [
{
name: 'Jose',
email: 'abcd.example.cc'
}
]
}
}