Skip to content

Commit

Permalink
handleLocalRepoStatusChanged
Browse files Browse the repository at this point in the history
  • Loading branch information
ylc395 committed Oct 17, 2021
1 parent 4d510d4 commit ffc43e0
Showing 1 changed file with 14 additions and 12 deletions.
26 changes: 14 additions & 12 deletions src/domain/service/PublishService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,19 +79,10 @@ export class PublishService {

private async init() {
this.outputDir.value = await this.generator.getOutputDir();
this.git.on(GitEvents.Progress, (e) => this.refreshPublishingProgress(e));
this.git.on(GitEvents.Message, (message) => this.refreshPublishingProgress({ message }));
this.git.on(GitEvents.LocalRepoStatusChanged, (e) => {
this.localRepoStatus = e;

if (this.localRepoStatus === LocalRepoStatus.Initializing) {
this.refreshPublishingProgress({
phase: 'Local repository initializing...',
message: '',
});
}
});

this.git.on(GitEvents.Progress, this.refreshPublishingProgress.bind(this));
this.git.on(GitEvents.Message, (message) => this.refreshPublishingProgress({ message }));
this.git.on(GitEvents.LocalRepoStatusChanged, this.handleLocalRepoStatusChanged.bind(this));
this.generator.on(GeneratorEvents.PageGenerated, this.refreshGeneratingProgress.bind(this));

this.githubInfo.value = {
Expand All @@ -105,6 +96,17 @@ export class PublishService {
}
}

private handleLocalRepoStatusChanged(status: LocalRepoStatus) {
this.localRepoStatus = status;

if (this.localRepoStatus === LocalRepoStatus.Initializing) {
this.refreshPublishingProgress({
phase: 'Local repository initializing...',
message: '',
});
}
}

isGithubInfoValid = computed(() => {
const requiredKeys: (keyof Github)[] = ['userName', 'email', 'token'];
const keyInfos = pick(this.githubInfo.value, requiredKeys);
Expand Down

0 comments on commit ffc43e0

Please sign in to comment.