#329738 Fix multiple calls to fetching functions on groups screen. Remove padding from group tabs.

This commit is contained in:
Georgi Prodanov 2017-03-07 17:00:11 +02:00
Родитель 932461e898
Коммит 049e225d0a
2 изменённых файлов: 13 добавлений и 5 удалений

Просмотреть файл

@ -1,5 +1,5 @@
.tab-item { .tab-item {
padding: 10 0; padding: 0 0;
} }
.tab-items-wrapper.no-groups { .tab-items-wrapper.no-groups {

Просмотреть файл

@ -85,7 +85,7 @@ export class GroupsComponent implements OnInit {
if (!this.hasMoreUserGroups || this._lockUserGroups) { if (!this.hasMoreUserGroups || this._lockUserGroups) {
return Promise.resolve(); return Promise.resolve();
} }
this._lockUserGroups = false; this._lockUserGroups = true;
return this._usersService.currentUser() return this._usersService.currentUser()
.then((u) => this._groupsService.getUserGroups(u.Id, this._userGroupsPage, this._pageSize)) .then((u) => this._groupsService.getUserGroups(u.Id, this._userGroupsPage, this._pageSize))
.then(groups => { .then(groups => {
@ -94,15 +94,19 @@ export class GroupsComponent implements OnInit {
if (this.hasMoreUserGroups) { if (this.hasMoreUserGroups) {
this._userGroupsPage++; this._userGroupsPage++;
} }
this._lockUserGroups = false;
}) })
.catch(err => this.hasMoreUserGroups = true); .catch(err => {
this._lockUserGroups = false;
this.hasMoreUserGroups = true
});
} }
loadMoresUnjoinedGroups() { loadMoresUnjoinedGroups() {
if (!this.hasMoreUnjoined || this._lockUnjoinedGroups) { if (!this.hasMoreUnjoined || this._lockUnjoinedGroups) {
return Promise.resolve(); return Promise.resolve();
} }
this._lockUnjoinedGroups = false; this._lockUnjoinedGroups = true;
return this._usersService.currentUser() return this._usersService.currentUser()
.then((u) => this._groupsService.getUnjoinedGroups(u.Id, this._unjoinedPage, this._pageSize)) .then((u) => this._groupsService.getUnjoinedGroups(u.Id, this._unjoinedPage, this._pageSize))
.then(groups => { .then(groups => {
@ -111,8 +115,12 @@ export class GroupsComponent implements OnInit {
if (this.hasMoreUnjoined) { if (this.hasMoreUnjoined) {
this._unjoinedPage++; this._unjoinedPage++;
} }
this._lockUnjoinedGroups = false;
}) })
.catch(err => this.hasMoreUnjoined = true); .catch(err => {
this._lockUnjoinedGroups = false;
this.hasMoreUnjoined = true;
});
} }
private _hasMore(receivedCount: number, pageSize: number) { private _hasMore(receivedCount: number, pageSize: number) {