Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

move invite page behind auth shell #280

Merged
merged 3 commits into from
Jan 13, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,10 @@ jobs:
- uses: supabase/setup-cli@v1
with:
version: latest
- run: supabase db start

- name: Start Supabase local development setup
run: supabase start
# - name: Start Supabase local development setup
# run: supabase start

- name: Verify generated types are checked in
run: |
Expand Down
14 changes: 2 additions & 12 deletions src/pages/InvitePage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,12 @@
<PrimaryButton
class="w-full mt-4"
:is-loading="joining"
:disabled="notSignedIn || joining"
:disabled="joining"
@click="joinCommunity"
>
Join now
</PrimaryButton>
</div>
<SignUpModal
:open="notSignedIn"
:allow-dismiss="false"
@signed-in="notSignedIn = false"
/>
</div>
</BaseTemplate>
</template>
Expand All @@ -43,7 +38,6 @@ import { onMounted, ref } from "vue";
import LoadingSpinner from "@/components/LoadingSpinner.vue";
import PrimaryButton from "@/components/Buttons/PrimaryButton.vue";
import useToast from "@/components/Toast/useToast";
import SignUpModal from "@/components/Modals/SignUpModal.vue";

const { showSuccess, showError } = useToast();

Expand All @@ -57,7 +51,6 @@ const inviteInfo = ref<{
const isLoading = ref(false);
const joining = ref(false);
const alreadyJoined = ref(false);
const notSignedIn = ref(false);

async function loadCommunityInvite() {
const { data } = await supabase
Expand Down Expand Up @@ -93,7 +86,7 @@ async function checkCommunityMember() {
async function joinCommunity() {
joining.value = true;
const { data } = await fetch(
`/.netlify/functions/joinThroughInviteLink?inviteId=${route.params.invite_id}&userId=${store.user?.id}&communityId=${inviteInfo.value?.community_id.id}`,
`/.netlify/functions/joinThroughInviteLink?inviteId=${route.params.invite_id}&userId=${store.user?.id}&communityId=${inviteInfo.value?.community_id.id}`
)
.then((response) => response.json())
.catch(() => {
Expand All @@ -110,9 +103,6 @@ async function joinCommunity() {

onMounted(async () => {
isLoading.value = true;
if (!store.user?.id) {
notSignedIn.value = true;
}
await loadCommunityInvite();
await checkCommunityMember();
isLoading.value = false;
Expand Down
9 changes: 9 additions & 0 deletions src/pages/InviteShell.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<template>
<AuthShell>
<InvitePage />
</AuthShell>
</template>
<script setup lang="ts">
import AuthShell from "@/layouts/AuthShell.vue";
import InvitePage from "./InvitePage.vue";
</script>
2 changes: 1 addition & 1 deletion src/router.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ const routes = [
},
{
path: "/invite/:invite_id",
component: () => import("@/pages/InvitePage.vue"),
component: () => import("@/pages/InviteShell.vue"),
meta: {
title: "Playabl",
},
Expand Down
Loading