Skip to content

Commit

Permalink
fix: fix past contents glitch (#87)
Browse files Browse the repository at this point in the history
  • Loading branch information
azu committed Jul 2, 2021
1 parent 3cc9649 commit 7f17bfb
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/use-case/subscription/ShowSubscriptionContentsUseCase.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import { repositoryContainer } from "../../infra/repository/RepositoryContainer"
export class StartLoadingPayload implements Payload {
type = "StartLoadingPayload";
}

export class FinishLoadingPayload implements Payload {
type = "FinishLoadingPayload";
}
Expand Down Expand Up @@ -44,8 +45,9 @@ export class ShowSubscriptionContentsUseCase extends UseCase {
const specResult = isSatisfiedSubscriptionContentsFetchSpec(subscription);
const app = this.repo.appRepository.get();
if (!specResult.ok) {
console.info(specResult.reason);
console.log("specResult.reason:", specResult.reason);
app.user.openNewSubscription(subscription);
await this.repo.appRepository.save(app);
this.dispatch(new FinishLoadingPayload());
return;
}
Expand All @@ -55,11 +57,12 @@ export class ShowSubscriptionContentsUseCase extends UseCase {
.streamContents(subscription, app.preferences.fetchContentsCount)
.then((response) => {
const subscriptionContents = createSubscriptionContentsFromResponse(response);
console.log("!!!!subscriptionContents", subscriptionContents);
const newSubscription = subscription.updateContents(subscriptionContents);
newSubscription.mutableEndContentUpdating();
this.repo.subscriptionRepository.save(newSubscription);
app.user.openNewSubscription(newSubscription);
this.repo.appRepository.save(app);
return this.repo.appRepository.save(app);
})
.then(() => {
this.dispatch(new FinishLoadingPayload());
Expand Down

0 comments on commit 7f17bfb

Please sign in to comment.