Skip to content

Commit

Permalink
fix: updated hashnode integration
Browse files Browse the repository at this point in the history
  • Loading branch information
matfire committed Jan 18, 2024
1 parent 5166be7 commit c70b7fd
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions src/lib/articles/platforms/hashnode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ export class HashnodePlatform implements IBasePlatform<HashnodePlatform> {
}
];
}
// 'hash_token', 'hash_publication'
getPlatformName(): string {
return 'hashnode';
}
Expand All @@ -46,23 +45,21 @@ export class HashnodePlatform implements IBasePlatform<HashnodePlatform> {
const token = this.settings['hash_token'];
const publication = this.settings['hash_publication'];
if (!token || !publication) throw new Error('could not find required settings');
const res = await fetch('https://api.hashnode.com', {
const res = await fetch('https://gql.hashnode.com', {
headers: {
Authorization: token,
'Content-Type': 'application/json'
},
method: 'POST',
body: JSON.stringify({
query:
'mutation createStory($input: CreateStoryInput!){ createStory(input: $input){ code success message } }',
'mutation publishPost($input: PublishPostInput!){ publishPost(input: $input){ post { id } } }',
variables: {
input: {
title: this.frontmatter.title,
contentMarkdown: content,
tags: [],
isPartOfPublication: {
publicationId: publication
}
publicationId: publication
}
}
})
Expand Down

0 comments on commit c70b7fd

Please sign in to comment.