refactor(frontend): 非推奨となったReactivity Transformを使わないように (#12539)
* refactor(frontend): 非推奨となったReactivity Transformを使わないように * refactor: 不要な括弧を除去 * fix: 不要なアノテーションを除去 * fix: Refの配列をrefしている部分の対応 * refactor: 不要な括弧を除去 * fix: lint * refactor: Ref、ShallowRef、ComputedRefの変数の宣言をletからconstに置換 * fix: type error * chore: drop reactivity transform from eslint configuration * refactor: remove unnecessary import * fix: 対応漏れ
This commit is contained in:
@@ -34,7 +34,7 @@ SPDX-License-Identifier: AGPL-3.0-only
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { watch, computed } from 'vue';
|
||||
import { watch, computed, ref } from 'vue';
|
||||
import * as os from '@/os.js';
|
||||
import { userPage } from '@/filters/user.js';
|
||||
import { i18n } from '@/i18n.js';
|
||||
@@ -47,41 +47,41 @@ const props = defineProps<{
|
||||
listId: string;
|
||||
}>();
|
||||
|
||||
let list = $ref(null);
|
||||
let error = $ref();
|
||||
let users = $ref([]);
|
||||
const list = ref(null);
|
||||
const error = ref();
|
||||
const users = ref([]);
|
||||
|
||||
function fetchList(): void {
|
||||
os.api('users/lists/show', {
|
||||
listId: props.listId,
|
||||
forPublic: true,
|
||||
}).then(_list => {
|
||||
list = _list;
|
||||
list.value = _list;
|
||||
os.api('users/show', {
|
||||
userIds: list.userIds,
|
||||
userIds: list.value.userIds,
|
||||
}).then(_users => {
|
||||
users = _users;
|
||||
users.value = _users;
|
||||
});
|
||||
}).catch(err => {
|
||||
error = err;
|
||||
error.value = err;
|
||||
});
|
||||
}
|
||||
|
||||
function like() {
|
||||
os.apiWithDialog('users/lists/favorite', {
|
||||
listId: list.id,
|
||||
listId: list.value.id,
|
||||
}).then(() => {
|
||||
list.isLiked = true;
|
||||
list.likedCount++;
|
||||
list.value.isLiked = true;
|
||||
list.value.likedCount++;
|
||||
});
|
||||
}
|
||||
|
||||
function unlike() {
|
||||
os.apiWithDialog('users/lists/unfavorite', {
|
||||
listId: list.id,
|
||||
listId: list.value.id,
|
||||
}).then(() => {
|
||||
list.isLiked = false;
|
||||
list.likedCount--;
|
||||
list.value.isLiked = false;
|
||||
list.value.likedCount--;
|
||||
});
|
||||
}
|
||||
|
||||
@@ -90,17 +90,17 @@ async function create() {
|
||||
title: i18n.ts.enterListName,
|
||||
});
|
||||
if (canceled) return;
|
||||
await os.apiWithDialog('users/lists/create-from-public', { name: name, listId: list.id });
|
||||
await os.apiWithDialog('users/lists/create-from-public', { name: name, listId: list.value.id });
|
||||
}
|
||||
|
||||
watch(() => props.listId, fetchList, { immediate: true });
|
||||
|
||||
const headerActions = $computed(() => []);
|
||||
const headerActions = computed(() => []);
|
||||
|
||||
const headerTabs = $computed(() => []);
|
||||
const headerTabs = computed(() => []);
|
||||
|
||||
definePageMetadata(computed(() => list ? {
|
||||
title: list.name,
|
||||
definePageMetadata(computed(() => list.value ? {
|
||||
title: list.value.name,
|
||||
icon: 'ti ti-list',
|
||||
} : null));
|
||||
</script>
|
||||
|
Reference in New Issue
Block a user