mirror of
https://github.com/hanzo-io/cloud.git
synced 2026-10-30 18:57:42 +00:00
24 lines
421 B
JavaScript
24 lines
421 B
JavaScript
import { createResource } from 'frappe-ui';
|
|
|
|
export let plans = createResource({
|
|
url: 'press.api.site.get_site_plans',
|
|
cache: 'site.plans',
|
|
initialData: []
|
|
});
|
|
|
|
export function fetchPlans() {
|
|
plans.fetch();
|
|
}
|
|
|
|
/**
|
|
* Get plans
|
|
* @returns {Array} List of plans
|
|
*/
|
|
export function getPlans() {
|
|
return plans.data || [];
|
|
}
|
|
|
|
export function getPlan(planName) {
|
|
return getPlans().find(plan => plan.name === planName);
|
|
}
|