Fix example.

This commit is contained in:
Dillon Kearns 2023-01-07 15:41:52 -08:00
parent a9c9b69031
commit e0d949c008
3 changed files with 5 additions and 4 deletions

View File

@ -53,7 +53,7 @@ routes getStaticRoutes htmlToString =
)
, ApiRoute.succeed
(\repoName ->
BackendTask.Http.get
BackendTask.Http.getJson
("https://api.github.com/repos/dillonkearns/" ++ repoName)
(Decode.field "stargazers_count" Decode.int)
|> BackendTask.map

View File

@ -142,7 +142,7 @@ pages =
data : RouteParams -> BackendTask Data
data routeParams =
BackendTask.Http.get
BackendTask.Http.getJson
(Secrets.succeed "https://api.github.com/repos/dillonkearns/elm-pages")
(Decode.field "stargazer_count" Decode.int)
@ -189,7 +189,7 @@ all =
repo : String -> BackendTask Repo
repo repoName =
BackendTask.Http.get (Secrets.succeed ("https://api.github.com/repos/dillonkearns/" ++ repoName))
BackendTask.Http.getJson (Secrets.succeed ("https://api.github.com/repos/dillonkearns/" ++ repoName))
(OptimizedDecoder.map Repo
(OptimizedDecoder.field "stargazers_count" OptimizedDecoder.int)
)
@ -240,7 +240,7 @@ head static =
data : RouteParams -> BackendTask Data
data routeParams =
BackendTask.Http.get
BackendTask.Http.getJson
(Secrets.succeed "https://api.github.com/repos/dillonkearns/elm-pages")
(OptimizedDecoder.field "stargazer_count" OptimizedDecoder.int)

View File

@ -50,6 +50,7 @@ staticRequest =
, method = "GET"
, headers = [ ( "Authorization", "Bearer " ++ airtableToken ), ( "view", "viwayJBsr63qRd7q3" ) ]
, body = BackendTask.Http.emptyBody
, options = Nothing
}
(BackendTask.Http.expectJson decoder)
|> BackendTask.throw