fix(fetch): add cache: 'no-store' to avoid errors

This commit is contained in:
Hexagonn
2024-10-22 09:00:18 +00:00
committed by GitHub
parent 5bb65e575c
commit ae954aabfb
3 changed files with 71 additions and 69 deletions

View File

@@ -39,9 +39,9 @@ export async function GET(
let getUser: any = {};
getUser.data = await fetch(
`https://api.lanyard.rest/v1/users/${userId}`,
).then(async (res) => {
getUser.data = await fetch(`https://api.lanyard.rest/v1/users/${userId}`, {
cache: "no-store",
}).then(async (res) => {
const data = await res.json();
if (!data.success) {

View File

@@ -9,9 +9,9 @@ export async function getUserCount() {
}
export async function isUserMonitored(userId: string) {
const user = await fetch(
`https://api.lanyard.rest/v1/users/${userId}`,
).then((res) => res.json());
const user = await fetch(`https://api.lanyard.rest/v1/users/${userId}`, {
cache: "no-store",
}).then((res) => res.json());
return user.success === true;
}

View File

@@ -2,7 +2,9 @@ export const encodeBase64 = async (url: string): Promise<string> => {
let response = "";
try {
response = await fetch(url)
response = await fetch(url, {
cache: "no-store",
})
.then((res) => res.blob())
.then(async (blob) => {
const buffer = Buffer.from(await blob.arrayBuffer());