Skip to content

Commit

Permalink
Merge pull request #33 from kuosc2005/patch-contribution-leaderboard-api
Browse files Browse the repository at this point in the history
patch: added env variable for contribution leaderboard base url
  • Loading branch information
abhiyandhakal authored Apr 29, 2024
2 parents 6729733 + ce13e8c commit b7560c7
Show file tree
Hide file tree
Showing 6 changed files with 43 additions and 5 deletions.
1 change: 1 addition & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
CONTRIBUTION_API_BASE_URL=
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

# Misc
.DS_Store
.env
.env.local
.env.development.local
.env.test.local
Expand Down
10 changes: 8 additions & 2 deletions docusaurus.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,12 @@ const config = {
routeBasePath: 'knowledgebase',
sidebarPath: require.resolve('./sidebarsKnowledgebase.js')
}
],
[
'docusaurus2-dotenv',
{
systemvars: true
}
]
],

Expand Down Expand Up @@ -95,8 +101,8 @@ const config = {
to: '/leaderboard/',
sidebarId: 'Leaderboard',
label: 'Leaderboard',
position: 'left',
},
position: 'left'
},
{
href: 'https://github.com/kuosc2005/website',
label: 'GitHub',
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
"@mdx-js/react": "^1.6.22",
"axios": "^1.5.0",
"clsx": "^1.2.1",
"docusaurus2-dotenv": "^1.4.0",
"prism-react-renderer": "^1.3.5",
"react": "^18.2.0",
"react-dom": "^18.2.0",
Expand Down
6 changes: 3 additions & 3 deletions src/pages/leaderboard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ export default function Leaderboard() {

const fetchData = async () => {
try {
const response = await axios.get('https://api.contributor.kuosc.org.np/api/v1/webhook');
const response = await axios.get(process.env.CONTRIBUTION_API_BASE_URL + 'api/v1/webhook');
if (response.data.success) {
console.log(response.data.data.docs);
console.log(response.data.data.docs);
setContributors(response.data.data.docs);
}
} catch (err) {
Expand All @@ -30,7 +30,7 @@ export default function Leaderboard() {

useEffect(() => {
if (contributors.length > 0) {
console.log(contributors[0]);
console.log(contributors[0]);
setSelectedContributor(contributors[0]);
}
}, [contributors]);
Expand Down
29 changes: 29 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3538,6 +3538,13 @@ dns-packet@^5.2.2:
dependencies:
"@leichtgewicht/ip-codec" "^2.0.1"

docusaurus2-dotenv@^1.4.0:
version "1.4.0"
resolved "https://registry.yarnpkg.com/docusaurus2-dotenv/-/docusaurus2-dotenv-1.4.0.tgz#9ab900e29de9081f9f1f28f7224ff63760385641"
integrity sha512-iWqem5fnBAyeBBtX75Fxp71uUAnwFaXzOmade8zAhN4vL3RG9m27sLSRwjJGVVgIkEo3esjGyCcTGTiCjfi+sg==
dependencies:
dotenv-webpack "1.7.0"

dom-converter@^0.2.0:
version "0.2.0"
resolved "https://registry.npmjs.org/dom-converter/-/dom-converter-0.2.0.tgz"
Expand Down Expand Up @@ -3615,6 +3622,28 @@ dot-prop@^5.2.0:
dependencies:
is-obj "^2.0.0"

<<<<<<< HEAD
dotenv-defaults@^1.0.2:
version "1.1.1"
resolved "https://registry.yarnpkg.com/dotenv-defaults/-/dotenv-defaults-1.1.1.tgz#032c024f4b5906d9990eb06d722dc74cc60ec1bd"
integrity sha512-6fPRo9o/3MxKvmRZBD3oNFdxODdhJtIy1zcJeUSCs6HCy4tarUpd+G67UTU9tF6OWXeSPqsm4fPAB+2eY9Rt9Q==
dependencies:
dotenv "^6.2.0"

dotenv-webpack@1.7.0:
version "1.7.0"
resolved "https://registry.yarnpkg.com/dotenv-webpack/-/dotenv-webpack-1.7.0.tgz#4384d8c57ee6f405c296278c14a9f9167856d3a1"
integrity sha512-wwNtOBW/6gLQSkb8p43y0Wts970A3xtNiG/mpwj9MLUhtPCQG6i+/DSXXoNN7fbPCU/vQ7JjwGmgOeGZSSZnsw==
dependencies:
dotenv-defaults "^1.0.2"

dotenv@^6.2.0:
version "6.2.0"
resolved "https://registry.yarnpkg.com/dotenv/-/dotenv-6.2.0.tgz#941c0410535d942c8becf28d3f357dbd9d476064"
integrity sha512-HygQCKUBSFl8wKQZBSemMywRWcEDNidvNbjGVyZu3nbZ8qq9ubiPoGLMdRDpfSrpkkm9BXYFkpKxxFX38o/76w==

=======
>>>>>>> 6729733911e2d6f9385fcb60b48fab76c3f92303
duplexer3@^0.1.4:
version "0.1.5"
resolved "https://registry.npmjs.org/duplexer3/-/duplexer3-0.1.5.tgz"
Expand Down

0 comments on commit b7560c7

Please sign in to comment.