Skip to content

Instantly share code, notes, and snippets.

View den-churbanov's full-sized avatar
💣

Denis den-churbanov

💣
  • Open Code
  • Russia, Samara
View GitHub Profile
@epicbytes
epicbytes / example.api.ts
Last active May 30, 2024 12:18
NextJS Authorization Files
/*** function that used as middleware ***/
accessToken: async (name) => {
if (typeof document === "undefined") return "";
let token = document.cookie
.split(";")
.filter((cookie) => cookie.startsWith("token"))[0];
if (!token) {
const response = await fetch("/api/refresh", { method: "POST" });