Skip to content

Commit

Permalink
fix change compend client
Browse files Browse the repository at this point in the history
  • Loading branch information
userXinos committed May 17, 2024
1 parent 8bf9de4 commit ff6a10f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/components/CompendiumPage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ const error = ref('');
const isFetching = ref(false);
const user = ref<User|User2|null>();
const guild = ref<Guild|Guild2>();
const defaultSwitchClient = ref(0);
const defaultSwitchClient = ref(parseInt(localStorage.getItem('compendium_client')) ?? 0);
onMounted(async () => {
isFetching.value = true;
Expand Down
4 changes: 3 additions & 1 deletion src/utils/compendium.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Compendium as Client1 } from 'bot_client';
import { Compendium as Client2 } from 'bot_client2';
import { ref } from 'vue';
import { ref, toRaw } from 'vue';

const clients = [Client1, Client2];

Expand Down Expand Up @@ -28,7 +28,9 @@ export function stop() {

export async function switchInstance(clientNum: number) {
stop();
const events = { ...toRaw(client.value._events) };
client.value = new clients[clientNum]();
client.value._events = events;
localStorage.setItem('compendium_client', String(clientNum));
await init();
}

0 comments on commit ff6a10f

Please sign in to comment.