Created
December 24, 2021 18:53
-
-
Save albertBarsegyan/358731a8b44dfd7dafdb91c63a316c45 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { Octokit } from '@octokit/rest'; | |
| export const octokit = new Octokit({ | |
| auth: process.env.NEXT_PUBLIC_GITHUB_TOKEN, | |
| }); | |
| export const octokitResponse = async (responseUrl, dataToSend) => { | |
| const responseData = await fetch(responseUrl, { | |
| body: JSON.stringify(dataToSend), | |
| method: 'POST', | |
| headers: { | |
| Accept: 'application/json', | |
| 'Content-Type': 'application/json', | |
| }, | |
| }); | |
| const parsedResponse = await responseData.json(); | |
| return parsedResponse; | |
| }; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment