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

Solved the issue for Exposed authInfo and made it in .env file #159

Closed
wants to merge 2 commits into from
Closed
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: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ node_modules
dist
dist-ssr
*.local
.env

# Editor directories and files
.vscode/*
Expand Down
56 changes: 45 additions & 11 deletions src/App.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,39 +29,73 @@ function App() {
const [progress, setProgress] = useState(0);

return (
<div className='container d-flex flex-column min-vh-100'>
<div className="container d-flex flex-column min-vh-100">
<Router>
<Navbar />
<LoadingBar height={3} color="#f11946" progress={progress} />

<main className="flex-grow-1 container mt-4">
<Routes>
<Route exact path="/" element={<Home setProgress={setProgress} />} />
<Route exact path="/about" element={<About setProgress={setProgress} />} />
<Route
exact
path="/"
element={<Home setProgress={setProgress} />}
/>
<Route
exact
path="/about"
element={<About setProgress={setProgress} />}
/>

{/* Audio Resource Pages */}
<Route exact path="/resources/audio" element={<Audio />} />
<Route exact path="/resources/audio/chanakya" element={<ChanakyaAudio setProgress={setProgress} />} />
<Route
exact
path="/resources/audio/chanakya"
element={<ChanakyaAudio setProgress={setProgress} />}
/>

{/* Video Resource Pages */}
<Route exact path="/resources/video" element={<Video />} />
<Route exact path="/resources/video/chanakya" element={<ChanakyaVideo setProgress={setProgress} />} />
<Route
exact
path="/resources/video/chanakya"
element={<ChanakyaVideo setProgress={setProgress} />}
/>

{/* Book Resource Pages */}
<Route exact path="/resources/book" element={<Book />} />
<Route exact path="/resources/book/chanakya" element={<ChanakyaBook setProgress={setProgress} />} />
<Route
exact
path="/resources/book/chanakya"
element={<ChanakyaBook setProgress={setProgress} />}
/>

{/* News Resource Pages */}
<Route exact path="/resources/news" element={<News />} />
<Route exact path="/resources/news/chanakya" element={<ChanakyaNews setProgress={setProgress} />} />
<Route
exact
path="/resources/news/chanakya"
element={<ChanakyaNews setProgress={setProgress} />}
/>

{/* Quiz Resource Pages */}
<Route exact path="/resources/quiz" element={<Quiz />} />
<Route exact path="/resources/quiz/chanakya" element={<ChanakyaQuiz setProgress={setProgress} />} />

<Route exact path="/contributor" element={<Contributors setProgress={setProgress} />} >
<Route
exact
path="/resources/quiz/chanakya"
element={<ChanakyaQuiz setProgress={setProgress} />}
/>

<Route
exact
path="/contributor"
element={<Contributors setProgress={setProgress} />}></Route>
<Route
path="/contributor/details"
element={<ContributorDetail setProgress={setProgress} />}>
{" "}
</Route>
<Route path="/contributor/details" element={<ContributorDetail setProgress={setProgress}/>}> </Route>

{/* Authentication Pages */}
<Route exact path="/auth/SignIn" element={<SignIn />} />
Expand Down
12 changes: 8 additions & 4 deletions src/components/Quotes/QuotesSection.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,22 @@ import "./QuoteSection.css";

const QuoteSection = () => {
const [quote, setQuote] = useState("");
const AuthInfo = process.env.QUOTES_API_KEY;

useEffect(() => {
fetchDailyQuote();
}, []);

const fetchDailyQuote = async () => {
try {
const response = await fetch("https://api.yourquoteapi.com/quotes?author=Chanakya", {
headers: {
"Authorization": `4fe303f4bamshb97ef5b1dd575e0p1ccc51jsnd9644d3c587b`
const response = await fetch(
"https://api.yourquoteapi.com/quotes?author=Chanakya",
{
headers: {
Authorization: AuthInfo,
},
}
});
);
const data = await response.json();
if (data && data.length > 0) {
setQuote(data[0].quote);
Expand Down
2 changes: 1 addition & 1 deletion src/database/quotes.json
Original file line number Diff line number Diff line change
Expand Up @@ -281,4 +281,4 @@
{
"quote": "Never make friends with people who are above or below you in status. Such friendships will never give you any happiness."
}
]
]
6 changes: 3 additions & 3 deletions src/main.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ import React from "react";
import ReactDOM from "react-dom/client";
import App from "./App.jsx";
import "bootstrap/dist/css/bootstrap.min.css";
import 'bootstrap/dist/js/bootstrap.bundle.min';
import "./index.css"
import "bootstrap/dist/js/bootstrap.bundle.min";
import "./index.css";

ReactDOM.createRoot(document.getElementById("root")).render(
<React.StrictMode>
<App />
</React.StrictMode>,
</React.StrictMode>
);