refactor: 変数の名前を変更

This commit is contained in:
Chocolate Pie 2023-07-05 08:14:25 +09:00
parent 0ee451af73
commit 5466f475d4
2 changed files with 6 additions and 6 deletions

View File

@ -56,7 +56,7 @@ const props = defineProps<{
expiresAt: string; expiresAt: string;
forward: boolean; forward: boolean;
expirationDate: string; expirationDate: string;
beforeExpiresAt?: string; previousExpiresAt?: string;
} }
editable: boolean; editable: boolean;
data?: { data?: {
@ -67,7 +67,7 @@ const props = defineProps<{
expirationDate: string | null; expirationDate: string | null;
expiresAt: string; expiresAt: string;
forward: boolean; forward: boolean;
beforeExpiresAt?: string; previousExpiresAt?: string;
} }
}>(); }>();
let expirationDate: string | null = $ref(null); let expirationDate: string | null = $ref(null);
@ -88,7 +88,7 @@ const value = computed({
expirationDate: null, expirationDate: null,
expiresAt: 'indefinitely', expiresAt: 'indefinitely',
forward: false, forward: false,
beforeExpiresAt: undefined, previousExpiresAt: undefined,
}; };
for (const [key, _value] of Object.entries(data)) { for (const [key, _value] of Object.entries(data)) {
if (_value === null) { if (_value === null) {
@ -123,7 +123,7 @@ watch(() => value.value.expirationDate, () => renderExpirationDate(), { immediat
watch(() => value.value.expiresAt, () => renderExpirationDate(true)); watch(() => value.value.expiresAt, () => renderExpirationDate(true));
watch(() => props.editable, () => { watch(() => props.editable, () => {
if (props.editable) { if (props.editable) {
value.value.beforeExpiresAt = value.value.expiresAt; value.value.previousExpiresAt = value.value.expiresAt;
} }
}); });

View File

@ -123,7 +123,7 @@ let editingResolver = $ref<{
expiresAt: string; expiresAt: string;
expirationDate: string; expirationDate: string;
forward: boolean; forward: boolean;
beforeExpiresAt?: string; previousExpiresAt?: string;
}>(defaultResolver); }>(defaultResolver);
const pagination = { const pagination = {
@ -156,7 +156,7 @@ function save(): void {
targetUserPattern: editingResolver.targetUserPattern || null, targetUserPattern: editingResolver.targetUserPattern || null,
reporterPattern: editingResolver.reporterPattern || null, reporterPattern: editingResolver.reporterPattern || null,
reportContentPattern: editingResolver.reportContentPattern || null, reportContentPattern: editingResolver.reportContentPattern || null,
...(editingResolver.beforeExpiresAt && editingResolver.beforeExpiresAt === editingResolver.expiresAt ? {} : { ...(editingResolver.previousExpiresAt && editingResolver.previousExpiresAt === editingResolver.expiresAt ? {} : {
expiresAt: editingResolver.expiresAt, expiresAt: editingResolver.expiresAt,
}), }),
forward: editingResolver.forward, forward: editingResolver.forward,