Skip to content

Commit

Permalink
🐛 async all the things
Browse files Browse the repository at this point in the history
  • Loading branch information
haliphax committed Mar 27, 2024
1 parent 4071441 commit 9fe709c
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions src/front-end/scripts/store/story.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ const story: Module<StoryState | Promise<StoryState>, StoreState> = {
const storyId = router.currentRoute.value.params.story as string;
const events = new EventSource(`${ROOT_URI}${storyId}/events`);

events.addEventListener("message", () => {
events.addEventListener("message", async () => {
console.log("Story update received");
ctx.dispatch("story.load");
await ctx.dispatch("story.load");
});
ctx.commit("events", events);

Expand All @@ -36,7 +36,7 @@ const story: Module<StoryState | Promise<StoryState>, StoreState> = {
await voteRepo.insert(partial);
}

ctx.dispatch("story.load");
await ctx.dispatch("story.load");
},
async "story.load"(ctx) {
const story = await remult
Expand Down
4 changes: 2 additions & 2 deletions src/front-end/scripts/views/story/actions.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@ const Actions = defineComponent({
await window.navigator.clipboard.writeText(window.location.href);
alert("The room URL has been copied to your clipboard!");
},
reveal() {
async reveal() {
if (
this.$store.state.story.story?.owner !== this.$store.state.session.id &&
!confirm("You are not the owner of this story. Are you sure?")
) {
return;
}
this.$store.dispatch("story.reveal");
await this.$store.dispatch("story.reveal");
},
},
});
Expand Down
4 changes: 2 additions & 2 deletions src/front-end/scripts/views/story/estimate.vue
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ const Estimate = defineComponent({
return classes;
},
vote(option: string) {
async vote(option: string) {
const payload: Vote =
this.you ??
(() => {
Expand All @@ -55,7 +55,7 @@ const Estimate = defineComponent({
} as Vote;
})();
payload.vote = option;
this.$store.dispatch("story.vote", payload);
await this.$store.dispatch("story.vote", payload);
},
},
});
Expand Down

0 comments on commit 9fe709c

Please sign in to comment.