mirror of
https://github.com/ThatGuySam/doesitarm.git
synced 2026-05-21 06:54:08 -07:00
Add getAppType function
This commit is contained in:
parent
bb7a8d2761
commit
7c696573e7
1 changed files with 20 additions and 3 deletions
|
|
@ -1,5 +1,20 @@
|
||||||
// App Data that is derived from other app data
|
// App Data that is derived from other app data
|
||||||
|
|
||||||
|
export function getAppType ( app ) {
|
||||||
|
|
||||||
|
if(app.category !== Object(app.category)) {
|
||||||
|
console.warn('app has no categories', app)
|
||||||
|
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
|
||||||
|
if (app.category.slug === 'homebrew') return 'formula'
|
||||||
|
|
||||||
|
if (app.category.slug === 'games') return 'game'
|
||||||
|
|
||||||
|
return 'app'
|
||||||
|
}
|
||||||
|
|
||||||
export function getAppEndpoint ( app ) {
|
export function getAppEndpoint ( app ) {
|
||||||
// console.log('app', app)
|
// console.log('app', app)
|
||||||
|
|
||||||
|
|
@ -7,11 +22,13 @@ export function getAppEndpoint ( app ) {
|
||||||
console.warn('app has no categories', app)
|
console.warn('app has no categories', app)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (app.category.slug === 'homebrew') return `/formula/${app.slug}`
|
const appType = getAppType( app )
|
||||||
|
|
||||||
if (app.category.slug === 'games') return `/game/${app.slug}`
|
// if (app.category.slug === 'homebrew') return `/formula/${app.slug}`
|
||||||
|
|
||||||
return `/app/${app.slug}`
|
// if (app.category.slug === 'games') return `/game/${app.slug}`
|
||||||
|
|
||||||
|
return `/${appType}/${app.slug}`
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getVideoEndpoint ( video ) {
|
export function getVideoEndpoint ( video ) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue