Skip to content

Commit

Permalink
feat(router helper): add method to generate route with active data as…
Browse files Browse the repository at this point in the history
… default
  • Loading branch information
AlejandroAkbal committed Oct 17, 2021
1 parent 527f6fa commit 579380f
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions assets/js/RouterHelper.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,28 @@ export class RouterHelper {

return RouterHelper.generatePostsRoute(domain, page, tags)
}

/**
* @param {Store<*> | boolean | ((typedArray: (Int8Array | Uint8Array | Int16Array | Uint16Array | Int32Array | Uint32Array), index: number, value: number) => number) | ((credential: Credential) => Promise<Credential>) | ((typedArray: (BigInt64Array | BigUint64Array), index: number, value: bigint) => bigint)} store
* @param {string} [domain]
* @param {number} [page]
* @param {string[]} [tags]
*/
static generatePostsRouteWithActiveDefaults(store, domain, page, tags) {
const STORE_GETTER = store.rootGetters ?? store.getters

if (domain == null) {
domain = STORE_GETTER['booru/getActiveBooru'].domain
}

if (page == null) {
page = STORE_GETTER['booru/getPageID']
}

if (tags == null) {
tags = STORE_GETTER['booru/getTags']
}

return RouterHelper.generatePostsRoute(domain, page, tags)
}
}

0 comments on commit 579380f

Please sign in to comment.