From 9c842d0a400ad4ab30796cc1a70fa8c3f799edf5 Mon Sep 17 00:00:00 2001 From: boojack Date: Fri, 15 Jul 2022 22:38:50 +0800 Subject: [PATCH] fix: remove axios withCredentials --- web/src/helpers/api.ts | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/web/src/helpers/api.ts b/web/src/helpers/api.ts index afaa6778..26ac0a7e 100644 --- a/web/src/helpers/api.ts +++ b/web/src/helpers/api.ts @@ -1,7 +1,5 @@ import axios from "axios"; -axios.defaults.withCredentials = true; - type ResponseObject = { data: T; error?: string; @@ -120,12 +118,11 @@ export function getTagList(tagFind?: TagFind) { } export async function getRepoStarCount() { - const data = ( - await axios.get("https://api.github.com/repos/usememos/memos", { - headers: { - accept: "application/vnd.github+json", - }, - }) - ).data; + const { data } = await axios.get(`https://api.github.com/repos/usememos/memos`, { + headers: { + Accept: "application/vnd.github.v3.star+json", + Authorization: "", + }, + }); return data.stargazers_count as number; }