Skip to content

Commit

Permalink
fix: github api requests rate issue (close #638)
Browse files Browse the repository at this point in the history
  • Loading branch information
orestbida committed Feb 17, 2024
1 parent 26d20ca commit 2ab787b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
2 changes: 1 addition & 1 deletion playground/src/components/sections/Header.astro
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { docsUrl, stackblitzUrl, repoUrl } from "../../data/metadata";
import { GithubIcon } from '../../data/icons';
---
<header>
<h1 class="page-title">CookieConsent v3<span data-latest-release data-minor-release class="fade-in title__minor-version">x.x</span></h1>
<h1 class="page-title">CookieConsent v3<span data-latest-release data-minor-release class="fade-in title__minor-version">.0.0</span></h1>
<h2 class="page-subtitle">A lightweight, GDPR and CCPA compliant Consent Management Tool written in vanilla JS.</h2>

<div class="main-links">
Expand Down
13 changes: 8 additions & 5 deletions playground/src/modules/fetchRelease.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,18 @@ onEvent(customEvents._PLAYGROUND_READY, async () => {
* Get last published v3 release
*/
export async function fetchLatestRelease() {
if (latest)
if (latest) {
return latest;
}

const res = await fetch('https://api.github.com/repos/orestbida/cookieconsent/tags');
const tags = await res.json();
const res = await fetch('https://raw.githubusercontent.com/orestbida/cookieconsent/master/package.json');

latest = tags.filter(tag => validRelease(tag.name))[0].name;
/**
* @type {import('../../package.json')}
*/
const pkg = await res.json();

return latest;
return pkg.version;
}

/**
Expand Down

0 comments on commit 2ab787b

Please sign in to comment.