fix: refresh bug

This commit is contained in:
thomas
2024-03-30 13:10:03 +01:00
parent 722ccc028e
commit 9b4ee0e5bf
2 changed files with 5 additions and 9 deletions

View File

@@ -53,7 +53,11 @@
async function fetchStats() {
try {
const response = await fetch(`https://api.github.com/repos/tomalaforge/angular-challenges`);
const response = await fetch(`https://api.github.com/repos/tomalaforge/angular-challenges`, {
headers: {
Authorization: `token ${$token}`
}
});
if (!response.ok) {
if (response.status === 401) {
const refresh = await fetch('/auth/refresh');

View File

@@ -1,8 +0,0 @@
import { defineMiddleware } from 'astro:middleware';
// `context` and `next` are automatically typed
export const onRequest = defineMiddleware((context, next) => {
console.log(context.cookies);
return next();
});