diff --git a/demo/package.json b/demo/package.json index ad7e19e..e36dcc5 100644 --- a/demo/package.json +++ b/demo/package.json @@ -1,6 +1,6 @@ { "name": "demo", - "version": "0.0.2", + "version": "0.0.1", "private": true, "license": "MIT", "dependencies": { diff --git a/demo/src/pages/index.tsx b/demo/src/pages/index.tsx index 8e467ec..3f469b4 100644 --- a/demo/src/pages/index.tsx +++ b/demo/src/pages/index.tsx @@ -3,7 +3,7 @@ import { graphql } from "gatsby" import * as React from "react" -const DiscordUserListsItems = ({ userPlaylists }) => ( +const DiscogsUserListsItems = ({ userPlaylists }) => ( {userPlaylists.map((p) => { if (!p.id) return null @@ -26,7 +26,7 @@ const DiscordUserListsItems = ({ userPlaylists }) => ( ) -const DiscordUserLists = ({ userPlaylists }) => ( +const DiscogsUserLists = ({ userPlaylists }) => ( {userPlaylists.map((p) => { if (!p.name) return null @@ -49,7 +49,7 @@ const DiscordUserLists = ({ userPlaylists }) => (

Resource URL: {p.resource_url}

Is public: {p.public === true ? `Yes` : `No`}

Items

- {p.items.length > 0 ? :

No items found

} + {p.items.length > 0 ? :

No items found

}
) })} @@ -65,7 +65,7 @@ const IndexPage = ({ data: { allDiscogsUserLists } }: { data: Queries.IndexPageQ

{allDiscogsUserLists.nodes && (allDiscogsUserLists.nodes.length > 0 ? ( - + ) : (

No playlists found

))} diff --git a/plugin/README.md b/plugin/README.md index 9ecec9e..4b3a75e 100644 --- a/plugin/README.md +++ b/plugin/README.md @@ -49,7 +49,7 @@ Your Discogs API token. Create an account on Discogs, go to [Settings > Develope ### username (**required**) -Your Discogs username. +The Discogs username to search. **Field type**: `String` diff --git a/plugin/src/__tests__/plugin-options-schema.ts b/plugin/src/__tests__/plugin-options-schema.ts index a082175..db84cbc 100644 --- a/plugin/src/__tests__/plugin-options-schema.ts +++ b/plugin/src/__tests__/plugin-options-schema.ts @@ -7,7 +7,6 @@ describe(`pluginOptionsSchema`, () => { const options = { api_token: undefined, username: undefined, - endpoints: `test`, } const { isValid, errors } = await testPluginOptionsSchema(pluginOptionsSchema, options) @@ -19,18 +18,6 @@ describe(`pluginOptionsSchema`, () => { const options = { api_token: undefined, username: undefined, - endpoints: [ - { - method: undefined, - args: `test`, - extension: { - method: undefined, - mapping: { - test: `test`, - }, - }, - }, - ], } const { isValid, errors } = await testPluginOptionsSchema(pluginOptionsSchema, options) diff --git a/plugin/src/constants.ts b/plugin/src/constants.ts index 83e7668..f16604d 100644 --- a/plugin/src/constants.ts +++ b/plugin/src/constants.ts @@ -1,22 +1,5 @@ export const DEFAULT_OPTIONS = {} -export const BASE_URL = `https://api.discogs.com/` - -export const SIZES = { - sq: `sq_75px`, - q: `sq_150px`, - t: `_100px`, - s: `_240px`, - n: `_320px`, - m: `_500px`, - z: `_640px`, - c: `_800px`, - l: `_1024px`, - h: `_1600px`, - k: `_2048px`, - o: `original`, -} - export const NODE_TYPE_BASE = `Discogs` export const NODE_SUBTYPE_USERLISTS = `UserLists` diff --git a/plugin/src/source-nodes.ts b/plugin/src/source-nodes.ts index 2740a0b..65768fa 100644 --- a/plugin/src/source-nodes.ts +++ b/plugin/src/source-nodes.ts @@ -11,12 +11,12 @@ export const sourceNodes: GatsbyNode["sourceNodes"] = async (gatsbyApi, pluginOp auth = { userToken: api_token } } const user = new Discogs(auth).user() - const userLists = promisify(user.getLists) + const userGetListsPromisse = promisify(user.getLists) let userListsRes try { - userListsRes = await userLists(username) + userListsRes = await userGetListsPromisse(username) } catch (error) { gatsbyApi.reporter.panicOnBuild({ id: ERROR_CODES.createDiscogsUser,