Skip to content

Commit 9ed8eee

Browse files
committed
🐛 add no-cache so node does not cache
1 parent bfae852 commit 9ed8eee

File tree

4 files changed

+20
-6
lines changed

4 files changed

+20
-6
lines changed

src/devto/post/content.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,9 @@ import { getApiUrl } from '../helpers/index.js';
2828
* @ignore
2929
*/
3030
export const fetchPost = async (id) => {
31-
const response = await fetch(`${getApiUrl()}/articles/${id}`);
31+
const response = await fetch(`${getApiUrl()}/articles/${id}`, {
32+
cache: 'no-cache',
33+
});
3234
const repoJson = await response.json();
3335
return repoJson;
3436
}
@@ -40,7 +42,9 @@ export const fetchPost = async (id) => {
4042
* @ignore
4143
*/
4244
export const fetchUserPosts = async (username) => {
43-
const articles = await fetch(`${getApiUrl()}/articles/latest?per_page=1000&username=${username?.toLowerCase()}`);
45+
const articles = await fetch(`${getApiUrl()}/articles/latest?per_page=1000&username=${username?.toLowerCase()}`, {
46+
cache: 'no-cache',
47+
});
4448
const articlesJson = await articles.json();
4549
return articlesJson;
4650
}

src/devto/user/content.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,13 @@ const blankPng = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1
4343
export const fetchUser = async (username, id) => {
4444
let response;
4545
if (!username && id) {
46-
response = await fetch(`${getApiUrl()}/users/${id}`);
46+
response = await fetch(`${getApiUrl()}/users/${id}`, {
47+
cache: 'no-cache',
48+
});
4749
} else {
48-
response = await fetch(`${getApiUrl()}/users/by_username?url=${username?.toLowerCase()}`);
50+
response = await fetch(`${getApiUrl()}/users/by_username?url=${username?.toLowerCase()}`, {
51+
cache: 'no-cache',
52+
});
4953
}
5054
const userJson = await response.json();
5155
return userJson;

src/github/repository/content.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,10 @@ const githubApi = 'https://api.github.com';
2626
* @ignore
2727
*/
2828
export const fetchRepo = async (full_name) => {
29-
const response = await fetch(`${githubApi}/repos/${full_name}`);
29+
const options = {
30+
cache: 'no-cache',
31+
};
32+
const response = await fetch(`${githubApi}/repos/${full_name}`, options);
3033
const repoJson = await response.json();
3134
return repoJson;
3235
}

src/github/user/content.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,10 @@ const blankPng = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1
3636
* @ignore
3737
*/
3838
export const fetchUser = async (username) => {
39-
const response = await fetch(`${githubApi}/users/${username}`);
39+
const options = {
40+
cache: 'no-cache',
41+
};
42+
const response = await fetch(`${githubApi}/users/${username}`, options);
4043
const userJson = await response.json();
4144
return userJson;
4245
}

0 commit comments

Comments
 (0)