Files
CRM_Montzar/apps/web/src/views/treasury/treasuryPageChrome.ts
T

34 lines
858 B
TypeScript
Raw Normal View History

import { inject, provide, ref, type InjectionKey, type Ref } from 'vue';
export type TreasuryChromeOverride = {
title: string | null;
description: string | null;
};
type TreasuryChromeApi = {
override: Ref<TreasuryChromeOverride>;
set: (next: TreasuryChromeOverride) => void;
clear: () => void;
};
const KEY: InjectionKey<TreasuryChromeApi> = Symbol('treasuryPageChrome');
export function provideTreasuryPageChrome(): TreasuryChromeApi {
const override = ref<TreasuryChromeOverride>({ title: null, description: null });
const api: TreasuryChromeApi = {
override,
set(next) {
override.value = next;
},
clear() {
override.value = { title: null, description: null };
},
};
provide(KEY, api);
return api;
}
export function useTreasuryPageChrome(): TreasuryChromeApi | null {
return inject(KEY, null);
}