1
0
mirror of https://github.com/misskey-dev/misskey.git synced 2026-05-22 08:14:07 +02:00

refactor(frontend): Formまわりの型強化 (#16260)

* refactor(frontend): Formまわりの型強化

* fix

* avoid non-null assertion and add null check for safety

* refactor

* avoid non-null assertion and add null check for safety

* Update clip.vue

---------

Co-authored-by: syuilo <4439005+syuilo@users.noreply.github.com>
This commit is contained in:
かっこかり
2025-07-06 19:36:11 +09:00
committed by GitHub
parent c2a01551a7
commit a8abb03d17
45 changed files with 344 additions and 239 deletions

View File

@@ -76,7 +76,8 @@ watch(() => props.clipId, async () => {
clip.value = await misskeyApi('clips/show', {
clipId: props.clipId,
});
favorited.value = clip.value.isFavorited;
favorited.value = clip.value!.isFavorited ?? false;
}, {
immediate: true,
});
@@ -108,6 +109,8 @@ const headerActions = computed(() => clip.value && isOwned.value ? [{
icon: 'ti ti-pencil',
text: i18n.ts.edit,
handler: async (): Promise<void> => {
if (clip.value == null) return;
const { canceled, result } = await os.form(clip.value.name, {
name: {
type: 'string',
@@ -128,6 +131,7 @@ const headerActions = computed(() => clip.value && isOwned.value ? [{
default: clip.value.isPublic,
},
});
if (canceled) return;
os.apiWithDialog('clips/update', {
@@ -178,6 +182,8 @@ const headerActions = computed(() => clip.value && isOwned.value ? [{
text: i18n.ts.delete,
danger: true,
handler: async (): Promise<void> => {
if (clip.value == null) return;
const { canceled } = await os.confirm({
type: 'warning',
text: i18n.tsx.deleteAreYouSure({ x: clip.value.name }),

View File

@@ -64,6 +64,7 @@ async function create() {
default: false,
},
});
if (canceled) return;
os.apiWithDialog('clips/create', result);

View File

@@ -79,7 +79,9 @@ async function createKey() {
default: scope.value.join('/'),
},
});
if (canceled) return;
os.apiWithDialog('i/registry/set', {
scope: result.scope.split('/'),
key: result.key,

View File

@@ -56,7 +56,9 @@ async function createKey() {
label: i18n.ts._registry.scope,
},
});
if (canceled) return;
os.apiWithDialog('i/registry/set', {
scope: result.scope.split('/'),
key: result.key,