Skip to content
This repository has been archived by the owner on Feb 27, 2024. It is now read-only.

Commit

Permalink
Merge pull request #254 from WebDevStudios/bugfix/253-Move-root-api-t…
Browse files Browse the repository at this point in the history
…o-lib

Move root api folder to lib/wpapi
  • Loading branch information
Greg Rickaby committed Mar 2, 2021
2 parents 3a9cfaf + e0806fe commit 2ea4959
Show file tree
Hide file tree
Showing 66 changed files with 59 additions and 59 deletions.
2 changes: 1 addition & 1 deletion components/molecules/AlgoliaResults/AlgoliaResults.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {searchResultsClient} from '@/api/algolia/connector'
import {WPContext} from '@/components/common/WordPressProvider'
import {searchResultsClient} from '@/lib/algolia/connector'
import PropTypes from 'prop-types'
import React, {useContext} from 'react'
import {Configure, InstantSearch} from 'react-instantsearch-dom'
Expand Down
2 changes: 1 addition & 1 deletion components/molecules/AlgoliaSearch/components/Search.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {searchClient} from '@/api/algolia/connector'
import {searchClient} from '@/lib/algolia/connector'
import PropTypes from 'prop-types'
import React, {useCallback, useEffect, useState} from 'react'
import {Configure, InstantSearch, SearchBox} from 'react-instantsearch-dom'
Expand Down
6 changes: 3 additions & 3 deletions components/molecules/Comments/Comments.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import Text from '@/components/atoms/Inputs/Text'
import Form from '@/components/molecules/Form'
import postComment from '@/lib/frontend/wp/comments/postComment'
import PropTypes from 'prop-types'
import React, {useState} from 'react'
import * as Yup from 'yup'
import Form from '@/components/molecules/Form'
import Text from '@/components/atoms/Inputs/Text'
import postComment from '@/api/frontend/wp/comments/postComment'

/**
* Render an individual comment component.
Expand Down
4 changes: 2 additions & 2 deletions functions/formatBlockData.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import getFormById from '@/api/wordpress/gravityForms/getFormById'
import getMediaByID from '@/api/wordpress/media/getMediaByID'
import getFormById from '@/lib/wordpress/gravityForms/getFormById'
import getMediaByID from '@/lib/wordpress/media/getMediaByID'

/**
* Format and retrieve expanded block data.
Expand Down
8 changes: 4 additions & 4 deletions functions/getPagePropTypes.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import PropTypes from 'prop-types'
import {
isValidPostType,
isHierarchicalPostType
} from '@/api/wordpress/_global/postTypes'
isHierarchicalPostType,
isValidPostType
} from '@/lib/wordpress/_global/postTypes'
import PropTypes from 'prop-types'

// Yoast SEO social prop types.
export const seoSocialPropTypes = {
Expand Down
2 changes: 1 addition & 1 deletion jsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"compilerOptions": {
"baseUrl": ".",
"paths": {
"@/api/*": ["api/*"],
"@/lib/*": ["lib/*"],
"@/components/*": ["components/*"],
"@/functions/*": ["functions/*"],
"@/styles/*": ["styles/*"]
Expand Down
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion api/frontend/connector.js → lib/frontend/connector.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {ApolloClient, InMemoryCache} from '@apollo/client'
import {initializeApollo} from '../apolloConfig'
import {RestLink} from 'apollo-link-rest'
import {initializeApollo} from '../apolloConfig'

let feApolloClient

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {wpDataEndpoints} from '@/lib/wordpress/connector'
import {gql} from '@apollo/client'
import {wpDataEndpoints} from '@/api/wordpress/connector'

// Query: retrieve archive posts by post type.
const queryArchivePosts = gql`
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {wpDataEndpoints} from '@/lib/wordpress/connector'
import commentsFields from '@/lib/wordpress/_partials/commentsFields'
import {gql} from '@apollo/client'
import {wpDataEndpoints} from '@/api/wordpress/connector'
import commentsFields from '@/api/wordpress/_partials/commentsFields'

// Mutation: Add a comment to the given post
const mutationAddComment = gql`
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import {algoliaIndexName} from '@/api/algolia/connector'
import getPostTypeById from './getPostTypeById'
import getPostTypeArchive, {archiveQuerySeo} from './getPostTypeArchive'
import {addApolloState} from '@/api/apolloConfig'
import {algoliaIndexName} from '@/lib/algolia/connector'
import {addApolloState} from '@/lib/apolloConfig'
import getFrontendPage, {frontendPageSeo} from './getFrontendPage'
import getPostTypeArchive, {archiveQuerySeo} from './getPostTypeArchive'
import getPostTypeById from './getPostTypeById'
import getPostTypeTaxonomyArchive from './getPostTypeTaxonomyArchive'
import getSettingsCustomPage, {
customPageQuerySeo
} from './getSettingsCustomPage'
import getPostTypeTaxonomyArchive from './getPostTypeTaxonomyArchive'

/**
* Retrieve static props by post type.
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
32 changes: 16 additions & 16 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
Expand Up @@ -75,7 +75,7 @@
"postcss-preset-env": "^6.7.0",
"prettier": "^2.2.1",
"prop-types": "^15.7.2",
"react-instantsearch-dom": "^6.10.0",
"react-instantsearch-dom": "^6.10.1",
"react-is": "^17.0.1",
"react-syntax-highlighter": "^15.4.3",
"react-twitter-embed": "^3.0.3",
Expand Down
2 changes: 1 addition & 1 deletion pages/404.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import getPostTypeStaticProps from '@/api/wordpress/_global/getPostTypeStaticProps'
import Container from '@/components/atoms/Container'
import Layout from '@/components/common/Layout'
import getPagePropTypes from '@/functions/getPagePropTypes'
import getPostTypeStaticProps from '@/lib/wordpress/_global/getPostTypeStaticProps'
import Page from './[...slug]'

// Define route post type.
Expand Down
4 changes: 2 additions & 2 deletions pages/[...slug].js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import getPostTypeStaticPaths from '@/api/wordpress/_global/getPostTypeStaticPaths'
import getPostTypeStaticProps from '@/api/wordpress/_global/getPostTypeStaticProps'
import Container from '@/components/atoms/Container'
import RichText from '@/components/atoms/RichText'
import Layout from '@/components/common/Layout'
import Blocks from '@/components/molecules/Blocks'
import getPagePropTypes from '@/functions/getPagePropTypes'
import getPostTypeStaticPaths from '@/lib/wordpress/_global/getPostTypeStaticPaths'
import getPostTypeStaticProps from '@/lib/wordpress/_global/getPostTypeStaticProps'

// Define route post type.
const postType = 'page'
Expand Down
2 changes: 1 addition & 1 deletion pages/_app.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import {useApollo} from '@/api/apolloConfig'
import WordPressProvider from '@/components/common/WordPressProvider'
import '@/styles/demo.css'
import '@/styles/index.css'
import {ApolloProvider} from '@apollo/client'
import {useApollo} from 'lib/apolloConfig'
import {DefaultSeo} from 'next-seo'
import Error from 'next/error'
import {useRouter} from 'next/router'
Expand Down
6 changes: 3 additions & 3 deletions pages/api/preview.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {wpPreviewSecret} from '@/api/wordpress/connector'
import getPostTypeById from '@/api/wordpress/_global/getPostTypeById'
import {postTypes} from '@/api/wordpress/_global/postTypes'
import {wpPreviewSecret} from '@/lib/wordpress/connector'
import getPostTypeById from '@/lib/wordpress/_global/getPostTypeById'
import {postTypes} from '@/lib/wordpress/_global/postTypes'

/**
* Provide post preview functionality.
Expand Down
2 changes: 1 addition & 1 deletion pages/api/wp/archive.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import getPostTypeArchive from '@/api/wordpress/_global/getPostTypeArchive'
import getPostTypeArchive from '@/lib/wordpress/_global/getPostTypeArchive'

/**
* Load more posts for an archive.
Expand Down
2 changes: 1 addition & 1 deletion pages/api/wp/getWPUrl.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {wpApiUrlBase} from '@/api/wordpress/connector'
import {wpApiUrlBase} from '@/lib/wordpress/connector'

/**
* Load more posts for an archive.
Expand Down
2 changes: 1 addition & 1 deletion pages/api/wp/postComment.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import postCommentToPost from '@/api/wordpress/_global/postCommentToPost'
import postCommentToPost from '@/lib/wordpress/_global/postCommentToPost'

/**
* Load more posts for an archive.
Expand Down
6 changes: 3 additions & 3 deletions pages/blog/[[...slug]].js
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
import getArchivePosts from '@/api/frontend/wp/archive/getArchivePosts'
import getPostTypeStaticPaths from '@/api/wordpress/_global/getPostTypeStaticPaths'
import getPostTypeStaticProps from '@/api/wordpress/_global/getPostTypeStaticProps'
import Breadcrumbs from '@/components/atoms/Breadcrumbs'
import Button from '@/components/atoms/Button'
import Container from '@/components/atoms/Container'
Expand All @@ -10,6 +7,9 @@ import Blocks from '@/components/molecules/Blocks'
import Card from '@/components/molecules/Card'
import Comments from '@/components/molecules/Comments'
import getPagePropTypes from '@/functions/getPagePropTypes'
import getArchivePosts from '@/lib/frontend/wp/archive/getArchivePosts'
import getPostTypeStaticPaths from '@/lib/wordpress/_global/getPostTypeStaticPaths'
import getPostTypeStaticProps from '@/lib/wordpress/_global/getPostTypeStaticProps'

// Define route post type.
const postType = 'post'
Expand Down
2 changes: 1 addition & 1 deletion pages/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import getPostTypeStaticProps from '@/api/wordpress/_global/getPostTypeStaticProps'
import Container from '@/components/atoms/Container'
import Layout from '@/components/common/Layout'
import getPagePropTypes from '@/functions/getPagePropTypes'
import getPostTypeStaticProps from '@/lib/wordpress/_global/getPostTypeStaticProps'
import Page from './[...slug]'

// Define route post type.
Expand Down
8 changes: 4 additions & 4 deletions pages/search.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import PropTypes from 'prop-types'
import getPostTypeStaticProps from '@/api/wordpress/_global/getPostTypeStaticProps'
import Container from '@/components/atoms/Container'
import Layout from '@/components/common/Layout'
import AlgoliaResults from '@/components/molecules/AlgoliaResults'
import {seoPropTypes} from '@/functions/getPagePropTypes'
import parseQuerystring from '@/functions/parseQuerystring'
import getPostTypeStaticProps from '@/lib/wordpress/_global/getPostTypeStaticProps'
import {useRouter} from 'next/router'
import {seoPropTypes} from '@/functions/getPagePropTypes'
import Container from '@/components/atoms/Container'
import PropTypes from 'prop-types'

/**
* Render the Search component.
Expand Down
6 changes: 3 additions & 3 deletions pages/team/[[...slug]].js
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
import getArchivePosts from '@/api/frontend/wp/archive/getArchivePosts'
import getPostTypeStaticPaths from '@/api/wordpress/_global/getPostTypeStaticPaths'
import getPostTypeStaticProps from '@/api/wordpress/_global/getPostTypeStaticProps'
import Breadcrumbs from '@/components/atoms/Breadcrumbs'
import Button from '@/components/atoms/Button'
import Container from '@/components/atoms/Container'
Expand All @@ -9,6 +6,9 @@ import Layout from '@/components/common/Layout'
import Blocks from '@/components/molecules/Blocks'
import Card from '@/components/molecules/Card'
import getPagePropTypes from '@/functions/getPagePropTypes'
import getArchivePosts from '@/lib/frontend/wp/archive/getArchivePosts'
import getPostTypeStaticPaths from '@/lib/wordpress/_global/getPostTypeStaticPaths'
import getPostTypeStaticProps from '@/lib/wordpress/_global/getPostTypeStaticProps'

// Define route post type.
const postType = 'team'
Expand Down

1 comment on commit 2ea4959

@vercel
Copy link

@vercel vercel bot commented on 2ea4959 Mar 2, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.