Skip to content

Commit

Permalink
fix blog post bug with draft posts (nmelhado#104)
Browse files Browse the repository at this point in the history
  • Loading branch information
nmelhado authored Jan 6, 2022
1 parent 7e9d4c7 commit a138cbd
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 6 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@

All notable changes to this project will be documented in this file.

## [1.2.16] - 2022-01-06

### Fixed

- Bug that would freeze pages if an incomplete draft blog post exists

## [1.2.15] - 2022-01-06

### Changed
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ Generate a custom league page for your Sleeper fantasy football league in just a
- If you run into trouble adding managers, reference the [Training Wheels' Manager section](https://github.com/nmelhado/league-page/blob/master/TRAINING_WHEELS.md#ii-adding-managers-and-changing-the-homepage-text)
- Add blog capabilities with [contenful](https://contentful.com/)
- Make a free contentful account
- Click on `Content model` in the top bar and create Blog Post (id: `blog_post`) and Blog Comment (id: `blog_comment`) content models that matches the specs below:
- Click on `Content model` in the top bar and create Blog Post (id: `blog_post`) and Blog Comment (id: `blog_comment`) content models that matches the specs below **(All fields are required)**:
![content model](https://storage.googleapis.com/nfl-player-data/contentModel.jpg)
![comment model](https://storage.googleapis.com/nfl-player-data/commentModel.jpg)
- Use sleeper your sleeper username for the author field when creating posts
Expand Down
2 changes: 1 addition & 1 deletion TRAINING_WHEELS.md
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ Generate a custom league page for your Sleeper fantasy football league in just a

- Add blog capabilities to your League Page with [contenful](https://contentful.com/)
- [Make a free contentful account](https://www.contentful.com/sign-up/)
- Click on `Content model` in the top bar and create Blog Post (id: `blog_post`) and Blog Comment (id: `blog_comment`) content models that matches the specs below:
- Click on `Content model` in the top bar and create Blog Post (id: `blog_post`) and Blog Comment (id: `blog_comment`) content models that matches the specs below **(All fields are required)**:
![content model](https://storage.googleapis.com/nfl-player-data/contentModel.jpg)
![comment model](https://storage.googleapis.com/nfl-player-data/commentModel.jpg)
- Use sleeper your sleeper username for the author field when creating posts
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "league-page",
"version": "1.2.15",
"version": "1.2.16",
"homepage": "https://github.com/nmelhado/league-page",
"repository": {
"type": "git",
Expand Down
2 changes: 1 addition & 1 deletion src/lib/version.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ available for your copy of League Page
*/

// Keep in sync with package.json
export const version = "1.2.15";
export const version = "1.2.16";
3 changes: 3 additions & 0 deletions src/routes/api/getBlogPosts.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ export async function get() {

const data = await res.json().catch((err) => { console.error(err); });

// Make sure only to return published posts
data.items = data.items.filter(i => i.sys.publishedVersion)

return {
status: 200,
body: JSON.stringify(data)
Expand Down

0 comments on commit a138cbd

Please sign in to comment.