Skip to content

Commit

Permalink
build: issue
Browse files Browse the repository at this point in the history
  • Loading branch information
raunakgurud09 committed Jan 31, 2024
1 parent 7e01154 commit 37526fe
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,15 +64,18 @@ const publishBlog = async (hashnode_key, article, host) => {
Authorization: `${hashnode_key}`,
};
try {
const { data: { data, error }, } = await (0, axios_1.default)({
const { data } = await (0, axios_1.default)({
url: constants_1.HASHNODE_ENDPOINT,
method: "post",
data: (0, api_1.PublishPost)(payload),
headers: headers,
});
return {
data: data,
error: error,
error: {
status_code: 400,
message: JSON.stringify(data),
},
};
}
catch (error) {
Expand Down Expand Up @@ -275,14 +278,10 @@ const publishToHashnode = async ({ host, hashnode_key, file, }) => {
// parse the file into content
const article = await (0, file_1.parseFile)(file);
// TODO: validation
const { data, error } = await (0, controller_1.publishBlog)(hashnode_key, article, host);
if (error) {
console.log(error);
process.exit(1);
}
console.log("res", data);
const res = await (0, controller_1.publishBlog)(hashnode_key, article, host);
console.log("res", res);
// return result of publish blog
return data;
return res;
};
exports.publishToHashnode = publishToHashnode;

Expand Down

0 comments on commit 37526fe

Please sign in to comment.