mirror of
https://github.com/ThatGuySam/doesitarm.git
synced 2026-05-15 06:35:20 -07:00
Use listEndpointPrefix to prevent kind collisions
This commit is contained in:
parent
3aa0955081
commit
b37e8bc8e7
1 changed files with 13 additions and 1 deletions
|
|
@ -145,6 +145,10 @@ class BuildLists {
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
||||||
|
getListOptions ( listName ) {
|
||||||
|
return this.listsOptions.find( listOption => listOption.name === listName )
|
||||||
|
}
|
||||||
|
|
||||||
shouldHaveRelatedVideos ( app ) {
|
shouldHaveRelatedVideos ( app ) {
|
||||||
const appType = getAppType( app )
|
const appType = getAppType( app )
|
||||||
|
|
||||||
|
|
@ -328,9 +332,12 @@ class BuildLists {
|
||||||
|
|
||||||
makeKindLists () {
|
makeKindLists () {
|
||||||
const getters = Object.fromEntries( Object.entries( this.lists ).map( ([ listName ]) => {
|
const getters = Object.fromEntries( Object.entries( this.lists ).map( ([ listName ]) => {
|
||||||
|
|
||||||
|
const listEndpointPrefix = this.getListOptions( listName ).endpointPrefix
|
||||||
|
|
||||||
return [
|
return [
|
||||||
// Key
|
// Key
|
||||||
listName,
|
listEndpointPrefix,
|
||||||
() => this.getListArrayMemoized( listName )
|
() => this.getListArrayMemoized( listName )
|
||||||
]
|
]
|
||||||
} ) )
|
} ) )
|
||||||
|
|
@ -338,12 +345,17 @@ class BuildLists {
|
||||||
// Add getters for categories
|
// Add getters for categories
|
||||||
// Homebrew category overrides Homebrew app type from above
|
// Homebrew category overrides Homebrew app type from above
|
||||||
for ( const categorySlug in categories ) {
|
for ( const categorySlug in categories ) {
|
||||||
|
// Throw if category already defined
|
||||||
|
if ( getters[categorySlug] ) throw Error(`Category ${categorySlug} already defined`)
|
||||||
|
|
||||||
getters[categorySlug] = () => this.getAppCategoryList( categorySlug )
|
getters[categorySlug] = () => this.getAppCategoryList( categorySlug )
|
||||||
}
|
}
|
||||||
|
|
||||||
const kindLists = {}
|
const kindLists = {}
|
||||||
|
|
||||||
for ( const kindSlug in getters ) {
|
for ( const kindSlug in getters ) {
|
||||||
|
// Throw if kindSlug already defined
|
||||||
|
if ( kindLists[kindSlug] ) throw Error(`Kind ${kindSlug} already defined`)
|
||||||
|
|
||||||
kindLists[ kindSlug ] = new KindList({
|
kindLists[ kindSlug ] = new KindList({
|
||||||
// Get list method
|
// Get list method
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue