Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: broken TypeScript in WordPress example. #39402

Merged
merged 14 commits into from Aug 8, 2022
4 changes: 2 additions & 2 deletions examples/cms-wordpress/README.md
@@ -1,6 +1,6 @@
# A statically generated blog example using Next.js and WordPress
# An Incremental Static Regeneration Blog Example Using Next.js and WordPress

This example showcases Next.js's [Static Generation](https://nextjs.org/docs/basic-features/pages) feature using [WordPress](https://wordpress.org) as the data source.
This example showcases Next.js's [Incremental Static Regeneration](https://nextjs.org/docs/basic-features/data-fetching/incremental-static-regeneration) feature using [WordPress](https://wordpress.org) as the data source.

## Demo

Expand Down
12 changes: 11 additions & 1 deletion examples/cms-wordpress/components/cover-image.tsx
Expand Up @@ -2,7 +2,17 @@ import cn from 'classnames'
import Image from 'next/image'
import Link from 'next/link'

export default function CoverImage({ title, coverImage, slug }) {
interface Props {
title: string
coverImage: {
node: {
sourceUrl: string
}
}
slug?: string
}

export default function CoverImage({ title, coverImage, slug }: Props) {
const image = (
<Image
width={2000}
Expand Down
2 changes: 1 addition & 1 deletion examples/cms-wordpress/lib/api.ts
@@ -1,6 +1,6 @@
const API_URL = process.env.WORDPRESS_API_URL

async function fetchAPI(query = '', { variables } = {}) {
async function fetchAPI(query = '', { variables }: Record<string, any> = {}) {
const headers = { 'Content-Type': 'application/json' }

if (process.env.WORDPRESS_AUTH_REFRESH_TOKEN) {
Expand Down
1 change: 1 addition & 0 deletions examples/cms-wordpress/next.config.js
Expand Up @@ -9,6 +9,7 @@ module.exports = {
images: {
domains: [
process.env.WORDPRESS_API_URL.match(/(?!(w+)\.)\w*(?:\w+\.)+\w+/)[0], // Valid WP Image domain.
'0.gravatar.com',
'1.gravatar.com',
'2.gravatar.com',
'secure.gravatar.com',
Expand Down