mirror of
https://github.com/mealie-recipes/mealie.git
synced 2025-10-28 08:44:36 -04:00
feat: Set default number of days on meal planner (#3650)
This commit is contained in:
@@ -18,6 +18,10 @@ export enum ImagePosition {
|
||||
right = "right",
|
||||
}
|
||||
|
||||
export interface UserMealPlanPreferences {
|
||||
numberOfDays: number;
|
||||
}
|
||||
|
||||
export interface UserRecipePreferences {
|
||||
orderBy: string;
|
||||
orderDirection: string;
|
||||
@@ -40,6 +44,20 @@ export interface UserParsingPreferences {
|
||||
parser: RegisteredParser;
|
||||
}
|
||||
|
||||
export function useUserMealPlanPreferences(): Ref<UserMealPlanPreferences> {
|
||||
const fromStorage = useLocalStorage(
|
||||
"meal-planner-preferences",
|
||||
{
|
||||
numberOfDays: 7,
|
||||
},
|
||||
{ mergeDefaults: true }
|
||||
// we cast to a Ref because by default it will return an optional type ref
|
||||
// but since we pass defaults we know all properties are set.
|
||||
) as unknown as Ref<UserMealPlanPreferences>;
|
||||
|
||||
return fromStorage;
|
||||
}
|
||||
|
||||
export function useUserPrintPreferences(): Ref<UserPrintPreferences> {
|
||||
const fromStorage = useLocalStorage(
|
||||
"recipe-print-preferences",
|
||||
|
||||
Reference in New Issue
Block a user