diff --git a/src/contexts/PreferencesContext.tsx b/src/contexts/PreferencesContext.tsx index 9e9a8cb..8232de3 100644 --- a/src/contexts/PreferencesContext.tsx +++ b/src/contexts/PreferencesContext.tsx @@ -1,6 +1,6 @@ "use client"; -import React, { createContext, useContext, useState } from "react"; +import React, { createContext, useContext, useState, useEffect } from "react"; import { ERROR_CODES } from "../constants/errorCodes"; import { AppError } from "../utils/errors"; import type { UserPreferences } from "@/types/preferences"; @@ -45,6 +45,10 @@ export function PreferencesProvider({ } }; + useEffect(() => { + fetchPreferences(); + }, []); + const updatePreferences = async (newPreferences: Partial) => { try { const response = await fetch("/api/preferences", {