Skip to content

Commit

Permalink
version for two clients link (#113)
Browse files Browse the repository at this point in the history
* version for two clients link

* fix

* Update CompendiumPage.vue

---------

Co-authored-by: Xinos <40886699+userXinos@users.noreply.github.com>
  • Loading branch information
mentalisit and userXinos authored May 30, 2024
1 parent 3ab0c63 commit 126b7fb
Showing 1 changed file with 16 additions and 9 deletions.
25 changes: 16 additions & 9 deletions src/components/CompendiumPage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@
<div class="footer">
<div class="content">
<p>Powered by <a
href="https://hs-compendium.com/"
:href="linkUrl"
target="_blank"
>HS Compendium</a></p>
</div>
Expand All @@ -101,9 +101,9 @@
</div>
<a
href="https://hs-compendium.com/"
:href="linkUrl"
target="_blank"
>HS Compendium</a>
>{{ linkText }}</a>
<div class="select switch-client">
<select
Expand Down Expand Up @@ -133,7 +133,7 @@
<!--suppress TypeScriptCheckImport -->
<script setup lang="ts">
import { onMounted, ref } from 'vue';
import { onMounted, ref, computed } from 'vue';
import { useStore } from 'vuex';
import { useRouter } from 'vue-router';
import { useI18n } from 'vue-i18n';
Expand All @@ -159,23 +159,30 @@ const isFetching = ref(false);
const user = ref<User|User2|null>();
const guild = ref<Guild|Guild2>();
const defaultSwitchClient = ref(parseInt(localStorage.getItem('compendium_client')) ?? 0);
const linkUrl = computed(() => {
return defaultSwitchClient.value === 0 ? 'https://hs-compendium.com/' : 'https://compendiumnew.mentalisit.myds.me/links';
});
const linkText = computed(() => {
return defaultSwitchClient.value === 0 ? 'HS Compendium' : 'invite';
});
onMounted(async () => {
isFetching.value = true;
await clientInit();
const u = client.value.getUser();
isFetching.value = false;
console.log(client.value, u);
if (!u) {
openCodeReqModal.value = true;
if ('client' in router.currentRoute.value.query) {
defaultSwitchClient.value = parseInt(router.currentRoute.value.query.client as string, 10);
selectClient(parseInt(router.currentRoute.value.query.client as string, 10));
}
if ('c' in router.currentRoute.value.query) {
reqCode.value = router.currentRoute.value.query.c as string;
}
if ('client' in router.currentRoute.value.query) {
defaultSwitchclient.value.value = parseInt(router.currentRoute.value.query.client as string, 10);
await applyReqCode();
}
} else {
user.value = u;
Expand Down

0 comments on commit 126b7fb

Please sign in to comment.