mirror of
https://github.com/Raghu-Ch/angular-challenges.git
synced 2026-02-10 12:53:03 -05:00
fix: refresh bug
This commit is contained in:
@@ -53,7 +53,11 @@
|
|||||||
|
|
||||||
async function fetchStats() {
|
async function fetchStats() {
|
||||||
try {
|
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.ok) {
|
||||||
if (response.status === 401) {
|
if (response.status === 401) {
|
||||||
const refresh = await fetch('/auth/refresh');
|
const refresh = await fetch('/auth/refresh');
|
||||||
|
|||||||
@@ -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();
|
|
||||||
});
|
|
||||||
Reference in New Issue
Block a user