Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix:기여대시보드 조회 제한 firebaes 연동 수정 #195

Merged
merged 1 commit into from
Oct 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .env.local

This file was deleted.

29 changes: 27 additions & 2 deletions components/contributeInfo.jsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,34 @@
import { useEffect, useState, useRef } from 'react';
import { Octokit } from 'octokit';
import { initializeApp } from "firebase/app";
import { getFirestore, doc, getDoc } from "firebase/firestore";
import { useTheme } from 'nextra-theme-docs';
import Table from './common/table';

const firebaseConfig = {
apiKey: "AIzaSyCMC07HfFRIFUVMA7eULAsmTvoC7Frpna8",
authDomain: "my-oss-pr.firebaseapp.com",
projectId: "my-oss-pr",
storageBucket: "my-oss-pr.appspot.com",
messagingSenderId: "6268125850",
appId: "1:6268125850:web:d84b95103cbd1e81a21523",
measurementId: "G-RLP5Y94VKY"
};

const app = initializeApp(firebaseConfig);
const db = getFirestore(app);

async function fetchToken() {
const docRef = doc(db, "oss", "info");
const docSnap = await getDoc(docRef);
if (docSnap.exists()) {
return docSnap.data().token;
} else {
console.error("No token found in Firestore");
return null;
}
}

const gitProfileBuilder = userInfo => (
<div className="flex items-center">
<div className="w-7 h-7 flex-shrink-0 mr-2 sm:mr-3">
Expand Down Expand Up @@ -79,8 +105,7 @@ const parseIssues = issues => {
};

const gitIssueBuilder = async (githubId, owner, repo) => {
const token = process.env.OCTOKIT_TOKEN;
console.log(token);
const token = await fetchToken();
const octokitAuth = new Octokit({ auth: token });
const octokitNoAuth = new Octokit();

Expand Down
Loading
Loading