Skip to content

Commit

Permalink
refactor: #12
Browse files Browse the repository at this point in the history
  • Loading branch information
raunakgurud09 committed Jan 31, 2024
1 parent 43084a4 commit 5926a87
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 4 deletions.
10 changes: 8 additions & 2 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.HASHNODE_ENDPOINT = void 0;
exports.HASHNODE_ENDPOINT = "https://gql.hashnode.com/";
exports.HASHNODE_ENDPOINT = "https://gql.hashnode.com";


/***/ }),
Expand Down Expand Up @@ -191,6 +191,9 @@ const getUser = async () => {
}
};
exports.getUser = getUser;
(async () => {
console.log(await (0, exports.getUser)());
})();


/***/ }),
Expand Down Expand Up @@ -301,7 +304,10 @@ const axios_1 = __importDefault(__nccwpck_require__(8757));
const constants_1 = __nccwpck_require__(5105);
const api = axios_1.default.create({
baseURL: constants_1.HASHNODE_ENDPOINT,
headers: { Authorization: `${process.env.HASHNODE_KEY}` },
headers: {
"Content-Type": "application/json",
Authorization: `${process.env.HASHNODE_KEY}`,
},
});
exports.api = api;

Expand Down
2 changes: 1 addition & 1 deletion src/constants.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export const HASHNODE_ENDPOINT = "https://gql.hashnode.com/";
export const HASHNODE_ENDPOINT = "https://gql.hashnode.com";
4 changes: 4 additions & 0 deletions src/controller/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -206,3 +206,7 @@ export const getUser = async (): Promise<any> => {
};
}
};

(async () => {
console.log(await getUser());
})();
5 changes: 4 additions & 1 deletion src/libs/axios.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@ import { HASHNODE_ENDPOINT } from "../constants";

const api = axios.create({
baseURL: HASHNODE_ENDPOINT,
headers: { Authorization: `${process.env.HASHNODE_KEY}` },
headers: {
"Content-Type": "application/json",
Authorization: `${process.env.HASHNODE_KEY}`,
},
});

export { api };

0 comments on commit 5926a87

Please sign in to comment.