Skip to content

Commit

Permalink
after joining deck, redirect to deck
Browse files Browse the repository at this point in the history
rather than leaving on preview
  • Loading branch information
jxjj committed Jan 23, 2025
1 parent 84b95f2 commit aaa0dad
Showing 1 changed file with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
</Button>
<Button
v-if="deck.capabilities.canJoinAsViewer"
@click="joinDeck(deck.id)"
@click="handleJoinDeck"
>Join</Button
>
<Button
Expand Down Expand Up @@ -54,6 +54,7 @@ import FlippableCard from "@/components/FlippableCard.vue";
import { ref } from "vue";
import { useJoinCommunityDeckMutation } from "@/queries/community";
import { useLeaveDeckMutation } from "@/queries/deckMemberships";
import { useRouter } from "vue-router";
const props = defineProps<{
deckId: number;
Expand All @@ -70,6 +71,12 @@ function flipAllCards() {
}
const { mutate: joinDeck } = useJoinCommunityDeckMutation();
const router = useRouter();
async function handleJoinDeck() {
await joinDeck(deckIdRef.value);
router.push({ name: "decks.show", params: { deckId: deckIdRef.value } });
}
const { mutate: leaveDeck } = useLeaveDeckMutation();
</script>
<style scoped></style>

0 comments on commit aaa0dad

Please sign in to comment.