From 01987ff311a03cc18d50ea4cac7bd6071b70b81e Mon Sep 17 00:00:00 2001 From: sabadev Date: Sat, 27 Mar 2021 11:47:12 -0400 Subject: [PATCH] Switched from 0 and 1 to dark and light. --- src/ApiTypes.hs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/ApiTypes.hs b/src/ApiTypes.hs index 11ab85f..3348aa6 100644 --- a/src/ApiTypes.hs +++ b/src/ApiTypes.hs @@ -20,13 +20,13 @@ type BlogId = FilePath data LightDark = Light | Dark deriving (Eq) instance FromHttpApiData LightDark where - parseQueryParam "0" = Right Dark - parseQueryParam "1" = Right Light - parseQueryParam x = Left $ "Invalid value " <> x <> ". Value must be either '0' or '1'." + parseQueryParam "dark" = Right Dark + parseQueryParam "light" = Right Light + parseQueryParam x = Left $ "Invalid value " <> x <> ". Value must be either 'dark' or 'light'." instance ToHttpApiData LightDark where - toQueryParam Dark = "0" - toQueryParam Light = "1" + toQueryParam Dark = "dark" + toQueryParam Light = "light" data Theme = Theme { themeType :: !LightDark , themeRed :: !Integer @@ -42,7 +42,7 @@ instance FromHttpApiData Theme where green <- parseColorComponent greenText blue <- parseColorComponent blueText pure $ Theme { themeType = light, themeRed = red, themeGreen = green, themeBlue = blue } - parseQueryParam theme = Left $ "Invalid value '" <> theme <> "'. Value must contain four integer values delimited by commas." + parseQueryParam theme = Left $ "Invalid value '" <> theme <> "'. Value must contain four values delimited by commas." instance ToHttpApiData Theme where toQueryParam theme = toQueryParam (themeType theme) <> "," <> toQueryParam (themeRed theme) <> "," <> toQueryParam (themeGreen theme) <> "," <> toQueryParam (themeBlue theme) -- 2.20.1