Skip to content

Commit 5f0b4b9

Browse files
committed
better service method names
1 parent da28c82 commit 5f0b4b9

4 files changed

Lines changed: 6 additions & 6 deletions

File tree

src/services/battleservice.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ export class BattleService {
2323
battleInfoForUser(id): Observable<CombatantInfo>{
2424
if (!this.cache[id]){
2525
let user$ = this.githubService.getUser(id);
26-
let repo$ = this.githubService.getRepoListPages(id);
26+
let repo$ = this.githubService.getRepos(id);
2727
return forkJoin(user$, repo$).pipe(map( ([user,list]) => {
2828
return ( this.cache[id] = ({id,user,repos:this.digestRepoList(list)}) );
2929
}));

src/services/githubservice.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ export class GithubService {
2323
return this.http.get<GithubUserFullInfo>(this.urls.urlToUser(id))
2424
}
2525
private getRepoListSinglePage(id,page=1) {
26-
return this.http.get<GithubRepo[]>(this.urls.urlToUserRepoListPage(id, page), { observe: 'response' }).pipe(
26+
return this.http.get<GithubRepo[]>(this.urls.urlToRepoList(id, page), { observe: 'response' }).pipe(
2727
map( (res) => ({
2828
repos: res.body,
2929
pageNumber: page,
@@ -43,8 +43,8 @@ export class GithubService {
4343
share()
4444
);
4545
}
46-
getRepoListPages(id){
47-
let page$ = this.getRepoListPageStream(id);
46+
getRepos(userId){
47+
let page$ = this.getRepoListPageStream(userId);
4848
let all$ = page$.pipe(
4949
map(val=>val.repos),
5050
scan((acc, val)=> (acc||[]).concat(val))

src/services/urlservice.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ const baseUrl = 'https://api.github.com/';
1515
@Injectable()
1616
export class UrlService {
1717
constructor(private authService: AuthService){}
18-
urlToUserRepoListPage(id, page=1) {
18+
urlToRepoList(id, page=1) {
1919
return baseUrl + 'users/' + id + '/repos?per_page=100&page=' + page + '&access_token=' + this.authService.authState.token;
2020
}
2121
urlToUser(id) {

src/specs/component.combatantdetail.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ const testModuleConfig = {
1616
declarations: [CombatantDetailComponent],
1717
}
1818

19-
// ------------ Moch input data -------------
19+
// ------------ Mock input data -------------
2020

2121
type RecursivePartial<T> = { [P in keyof T]?: RecursivePartial<T[P]>; }; // https://stackoverflow.com/a/47914631
2222
import { CombatantInfo } from '../types';

0 commit comments

Comments
 (0)