mirror of
https://github.com/misskey-dev/misskey.git
synced 2026-05-05 19:26:02 +02:00
refactor
This commit is contained in:
@@ -140,15 +140,15 @@ function toggleDayOfWeek(ad, index) {
|
||||
|
||||
function add() {
|
||||
ads.value.unshift({
|
||||
id: null,
|
||||
id: '',
|
||||
memo: '',
|
||||
place: 'square',
|
||||
priority: 'middle',
|
||||
ratio: 1,
|
||||
url: '',
|
||||
imageUrl: null,
|
||||
expiresAt: null,
|
||||
startsAt: null,
|
||||
imageUrl: '',
|
||||
expiresAt: new Date().toISOString(),
|
||||
startsAt: new Date().toISOString(),
|
||||
dayOfWeek: 0,
|
||||
});
|
||||
}
|
||||
@@ -160,7 +160,7 @@ function remove(ad) {
|
||||
}).then(({ canceled }) => {
|
||||
if (canceled) return;
|
||||
ads.value = ads.value.filter(x => x !== ad);
|
||||
if (ad.id == null) return;
|
||||
if (ad.id === '') return;
|
||||
os.apiWithDialog('admin/ad/delete', {
|
||||
id: ad.id,
|
||||
}).then(() => {
|
||||
@@ -170,7 +170,7 @@ function remove(ad) {
|
||||
}
|
||||
|
||||
function save(ad) {
|
||||
if (ad.id == null) {
|
||||
if (ad.id === '') {
|
||||
misskeyApi('admin/ad/create', {
|
||||
...ad,
|
||||
expiresAt: new Date(ad.expiresAt).getTime(),
|
||||
@@ -207,7 +207,7 @@ function save(ad) {
|
||||
}
|
||||
|
||||
function more() {
|
||||
misskeyApi('admin/ad/list', { untilId: ads.value.reduce((acc, ad) => ad.id != null ? ad : acc).id, publishing: publishing }).then(adsResponse => {
|
||||
misskeyApi('admin/ad/list', { untilId: ads.value.reduce((acc, ad) => ad.id !== '' ? ad : acc).id, publishing: publishing }).then(adsResponse => {
|
||||
if (adsResponse == null) return;
|
||||
ads.value = ads.value.concat(adsResponse.map(r => {
|
||||
const exdate = new Date(r.expiresAt);
|
||||
|
||||
Reference in New Issue
Block a user