refactor: event delegation, unified subscription cleanup, centralized listing status helpers
This commit is contained in:
@@ -75,6 +75,18 @@ class ListingsService {
|
||||
&& listing.expires_at
|
||||
&& new Date(listing.expires_at) > new Date()
|
||||
}
|
||||
|
||||
canTogglePublish(listing) {
|
||||
return listing.status === 'published' || (listing.status === 'draft' && this.isPaidAndActive(listing))
|
||||
}
|
||||
|
||||
isSoftDeleted(listing) {
|
||||
return listing.status === 'deleted'
|
||||
}
|
||||
|
||||
canPublicView(listing) {
|
||||
return listing.status === 'published'
|
||||
}
|
||||
}
|
||||
|
||||
export const listingsService = new ListingsService()
|
||||
|
||||
Reference in New Issue
Block a user