Skip to content

Commit

Permalink
Merge commit 'refs/pull/12105/head' of https://github.com/misskey-dev…
Browse files Browse the repository at this point in the history
…/misskey into develop
  • Loading branch information
noridev committed Oct 21, 2023
2 parents 3a49509 + 86be3ba commit ce00aa9
Showing 1 changed file with 14 additions and 8 deletions.
22 changes: 14 additions & 8 deletions packages/frontend/src/pages/install-extentions.vue
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ SPDX-License-Identifier: AGPL-3.0-only
</template>

<script lang="ts" setup>
import { ref, computed, onMounted, nextTick } from 'vue';
import { ref, computed, onActivated, onDeactivated, nextTick } from 'vue';
import MkLoading from '@/components/global/MkLoading.vue';
import MkButton from '@/components/MkButton.vue';
import FormSection from '@/components/form/section.vue';
Expand All @@ -121,9 +121,8 @@ const errorKV = ref<{
description: '',
});

const urlParams = new URLSearchParams(window.location.search);
const url = urlParams.get('url');
const hash = urlParams.get('hash');
const url = ref<string | null>(null);
const hash = ref<string | null>(null);

const data = ref<{
type: 'plugin' | 'theme';
Expand Down Expand Up @@ -153,7 +152,7 @@ function goToMisskey(): void {
}

async function fetch() {
if (!url || !hash) {
if (!url.value || !hash.value) {
errorKV.value = {
title: i18n.ts._externalResourceInstaller._errors._invalidParams.title,
description: i18n.ts._externalResourceInstaller._errors._invalidParams.description,
Expand All @@ -162,8 +161,8 @@ async function fetch() {
return;
}
const res = await os.api('fetch-external-resources', {
url,
hash,
url: url.value,
hash: hash.value,
}).catch((err) => {
switch (err.id) {
case 'bb774091-7a15-4a70-9dc5-6ac8cf125856':
Expand Down Expand Up @@ -298,10 +297,17 @@ async function install() {
}
}

onMounted(() => {
onActivated(() => {
const urlParams = new URLSearchParams(window.location.search);
url.value = urlParams.get('url');
hash.value = urlParams.get('hash');
fetch();
});

onDeactivated(() => {
uiPhase.value = 'fetching';
});

const headerActions = computed(() => []);

const headerTabs = computed(() => []);
Expand Down

0 comments on commit ce00aa9

Please sign in to comment.