Skip to content

Commit

Permalink
[fix] Total Count of Repository model
Browse files Browse the repository at this point in the history
  • Loading branch information
TechQuery committed Sep 3, 2024
1 parent 0a30625 commit 6cc83bc
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "mobx-github",
"version": "0.3.3",
"version": "0.3.4",
"license": "LGPL-3.0-or-later",
"author": "shiy2008@gmail.com",
"description": "MobX SDK for GitHub RESTful API, which is based on MobX-RESTful.",
Expand Down
24 changes: 12 additions & 12 deletions source/Repository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -130,18 +130,18 @@ export class RepositoryModel extends ListModel<
...(await this.getOneRelation(item.full_name, relation))
}))
);
if (!isUser) {
const { public_repos } =
await this.organizationStore.getOne(namespace);

return { pageData, totalCount: public_repos };
}
if (!this.totalCount) {
const { body } = await this.client.get<User>('user');

var totalCount =
body!.public_repos + (body!.total_private_repos || 0);
}
var { totalCount } = this;

if (!this.totalCount)
if (!isUser)
({ public_repos: totalCount } =
await this.organizationStore.getOne(namespace));
else {
const { body } = await this.client.get<User>('user');

totalCount =
body!.public_repos + (body!.total_private_repos || 0);
}
return { pageData, totalCount };
}

Expand Down

0 comments on commit 6cc83bc

Please sign in to comment.