diff --git a/frontend/src/context/app-context.tsx b/frontend/src/context/app-context.tsx index b8044f6..13abf50 100644 --- a/frontend/src/context/app-context.tsx +++ b/frontend/src/context/app-context.tsx @@ -1,4 +1,7 @@ -import { AppContextSchema } from "@/schemas/app-context-schema"; +import { + appContextSchema, + AppContextSchema, +} from "@/schemas/app-context-schema"; import { createContext, useContext } from "react"; import { useSuspenseQuery } from "@tanstack/react-query"; import axios from "axios"; @@ -19,7 +22,15 @@ export const AppContextProvider = ({ throw error; } - return {children}; + const validated = appContextSchema.safeParse(data); + + if (validated.success === false) { + throw validated.error; + } + + return ( + {children} + ); }; export const useAppContext = () => { diff --git a/frontend/src/context/user-context.tsx b/frontend/src/context/user-context.tsx index 84130d6..43b3c00 100644 --- a/frontend/src/context/user-context.tsx +++ b/frontend/src/context/user-context.tsx @@ -1,4 +1,7 @@ -import { UserContextSchema } from "@/schemas/user-context-schema"; +import { + userContextSchema, + UserContextSchema, +} from "@/schemas/user-context-schema"; import { createContext, useContext } from "react"; import { useSuspenseQuery } from "@tanstack/react-query"; import axios from "axios"; @@ -19,7 +22,17 @@ export const UserContextProvider = ({ throw error; } - return {children}; + const validated = userContextSchema.safeParse(data); + + if (validated.success === false) { + throw validated.error; + } + + return ( + + {children} + + ); }; export const useUserContext = () => { diff --git a/internal/types/config.go b/internal/types/config.go index fdf7bf8..2dd8ba9 100644 --- a/internal/types/config.go +++ b/internal/types/config.go @@ -34,7 +34,7 @@ type Config struct { LoginTimeout int `mapstructure:"login-timeout"` LoginMaxRetries int `mapstructure:"login-max-retries"` FogotPasswordMessage string `mapstructure:"forgot-password-message" validate:"required"` - BackgroundImage string `mapstructure:"background-image" validate:"required"` + BackgroundImage string `mapstructure:"background-image" validate:"required,url"` } // Server configuration