Skip to content

Commit

Permalink
refactor: #6
Browse files Browse the repository at this point in the history
  • Loading branch information
raunakgurud09 committed Jan 31, 2024
1 parent 37526fe commit da4f931
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
6 changes: 4 additions & 2 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,12 @@ const publishBlog = async (hashnode_key, article, host) => {
headers: headers,
});
return {
data: data,
data: data.data,
error: {
status_code: 400,
message: JSON.stringify(data),
// message: JSON.stringify(data),
message: data.errors[0].message,
info: data.errors[0].extensions,
},
};
}
Expand Down
12 changes: 9 additions & 3 deletions src/controller/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,11 @@ export const publishBlog = async (
host: string
): Promise<{
data: any | null;
error: { status_code: number | string; message: string } | null;
error: {
status_code: number | string;
message: string;
info?: string | undefined;
} | null;
}> => {
const toPublish = article.data.publish ?? false;

Expand Down Expand Up @@ -68,10 +72,12 @@ export const publishBlog = async (
});

return {
data: data,
data: data.data,
error: {
status_code: 400,
message: JSON.stringify(data),
// message: JSON.stringify(data),
message: data.errors[0].message,
info: data.errors[0].extensions,
},
};
} catch (error) {
Expand Down

0 comments on commit da4f931

Please sign in to comment.