mirror of
https://github.com/hay-kot/homebox.git
synced 2024-11-16 13:48:44 +00:00
95ab14b866
* format readme * update logo * format html * add logo to docs * repository for document and document tokens * add attachments type and repository * autogenerate types via scripts * use autogenerated types * attachment type updates * add insured and quantity fields for items * implement HasID interface for entities * implement label updates for items * implement service update method * WIP item update client side actions * check err on attachment * finish types for basic items editor * remove unused var * house keeping
27 lines
786 B
TypeScript
27 lines
786 B
TypeScript
import { Ref } from "vue";
|
|
|
|
export type LocationViewPreferences = {
|
|
showDetails: boolean;
|
|
showEmpty: boolean;
|
|
editorSimpleView: boolean;
|
|
};
|
|
|
|
/**
|
|
* useViewPreferences loads the view preferences from local storage and hydrates
|
|
* them. These are reactive and will update the local storage when changed.
|
|
*/
|
|
export function useViewPreferences(): Ref<LocationViewPreferences> {
|
|
const results = useLocalStorage(
|
|
"homebox/preferences/location",
|
|
{
|
|
showDetails: true,
|
|
showEmpty: true,
|
|
editorSimpleView: true,
|
|
},
|
|
{ mergeDefaults: true }
|
|
);
|
|
|
|
// casting is required because the type returned is removable, however since we
|
|
// use `mergeDefaults` the result _should_ always be present.
|
|
return results as unknown as Ref<LocationViewPreferences>;
|
|
}
|