🚑 Fix last guild
This commit is contained in:
parent
f1dffa0b07
commit
b27eeb8a03
@ -9,6 +9,8 @@
|
||||
active-color="primary"
|
||||
:to="getToUrl(guild)"
|
||||
:disabled="shouldBeDisabled(guild)"
|
||||
:data-guild-id="guild.id"
|
||||
@click="clickOnGuild(guild.id)"
|
||||
>
|
||||
<v-list-item-avatar
|
||||
start
|
||||
@ -75,6 +77,10 @@ function getToUrl(guild: Guild): RouteLocationRaw {
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
function clickOnGuild(guildId: string) {
|
||||
mutualGuildsStore.lastGuildId = guildId;
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped></style>
|
||||
|
@ -24,14 +24,14 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import GuildHeaderComponent from "@/components/guild/GuildHeaderComponent.vue";
|
||||
import { useMutualGuildsStore } from "@/stores/mutualGuilds";
|
||||
import { redirectIfNoGuild } from "@/tools/GuildTools";
|
||||
import { ref, watch } from "vue";
|
||||
import { ref } from "vue";
|
||||
import { useRoute, useRouter } from "vue-router";
|
||||
import AudioPreviewComponent from "../components/guild/home/AudioPreviewComponent.vue";
|
||||
import SettingPreviewComponent from "../components/guild/home/SettingPreviewComponent.vue";
|
||||
import StatsPreviewComponent from "../components/guild/home/StatsPreviewComponent.vue";
|
||||
import GuildHeaderComponent from "@/components/guild/GuildHeaderComponent.vue";
|
||||
|
||||
const guildStore = useMutualGuildsStore();
|
||||
const route = useRoute();
|
||||
@ -39,15 +39,6 @@ const router = useRouter();
|
||||
|
||||
const guild = ref(guildStore.getGuild(route.params.guildId as string));
|
||||
redirectIfNoGuild(guild.value, router);
|
||||
|
||||
watch(
|
||||
() => route.params.guildId,
|
||||
(value, oldValue) => {
|
||||
guild.value = guildStore.getGuild(value as string);
|
||||
guildStore.lastGuildId = guild.value?.id;
|
||||
redirectIfNoGuild(guild.value, router);
|
||||
}
|
||||
);
|
||||
</script>
|
||||
|
||||
<style scoped></style>
|
||||
|
@ -10,27 +10,19 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import GuildHeaderComponent from "@/components/guild/GuildHeaderComponent.vue";
|
||||
import { useMutualGuildsStore } from "@/stores/mutualGuilds";
|
||||
import { redirectIfNoGuild } from "@/tools/GuildTools";
|
||||
import { ref, watch } from "vue";
|
||||
import { ref } from "vue";
|
||||
import { useRoute, useRouter } from "vue-router";
|
||||
import SettingListComponent from "../components/guild/Settings/SettingListComponent.vue";
|
||||
import GuildHeaderComponent from "@/components/guild/GuildHeaderComponent.vue";
|
||||
|
||||
const guildStore = useMutualGuildsStore();
|
||||
const route = useRoute();
|
||||
const router = useRouter();
|
||||
|
||||
const guild = ref(guildStore.getGuild(route.params.guildId as string));
|
||||
redirectIfNoGuild(guild.value, router);
|
||||
|
||||
watch(
|
||||
() => route.params.guildId,
|
||||
(value, oldValue) => {
|
||||
guild.value = guildStore.getGuild(value as string);
|
||||
guildStore.lastGuildId = guild.value?.id;
|
||||
redirectIfNoGuild(guild.value, router);
|
||||
}
|
||||
);
|
||||
</script>
|
||||
|
||||
<style scoped></style>
|
||||
|
@ -15,11 +15,12 @@ import { useMutualGuildsStore } from "@/stores/mutualGuilds";
|
||||
import { useUserStore } from "@/stores/user";
|
||||
import { onBeforeMount } from "vue";
|
||||
import { useRouter } from "vue-router";
|
||||
|
||||
const userStore = useUserStore();
|
||||
const mutualGuildStore = useMutualGuildsStore();
|
||||
const router = useRouter();
|
||||
|
||||
onBeforeMount(() => {
|
||||
const mutualGuildStore = useMutualGuildsStore();
|
||||
if (userStore.isLoggedIn) {
|
||||
if (!mutualGuildStore.lastGuildId) {
|
||||
mutualGuildStore.lastGuildId = mutualGuildStore.guilds[0]?.id;
|
||||
|
Loading…
Reference in New Issue
Block a user