first commit

This commit is contained in:
2026-07-16 20:48:43 -03:00
commit 5696cee264
1111 changed files with 322270 additions and 0 deletions
+23
View File
@@ -0,0 +1,23 @@
// axios-config.js
import axios from "axios";
import { getTokenFromLocalStorage } from "./token";
/*
const instance = axios.create({
baseURL: process.env.NEXT_PUBLIC_API_URL,
headers: {
"Content-Type": "application/json",
Authorization: getTokenFromLocalStorage(),
},
});*/
const instance = () =>
axios.create({
baseURL: process.env.NEXT_PUBLIC_API_URL,
headers: {
"Content-Type": "application/json",
Authorization: getTokenFromLocalStorage(),
},
});
export default instance;
+22
View File
@@ -0,0 +1,22 @@
"use client";
export function getTokenFromLocalStorage(): string {
if (typeof window !== "undefined") {
if (!localStorage) {
throw new Error("Local storage not found");
}
// Get the stored data from local storage
const storedData = localStorage.getItem("site-session-token");
// Parse the stored data as JSON
const jsonData = storedData ? JSON.parse(storedData) : null;
// If jsonData is truthy, return the token value
if (jsonData) {
return jsonData.state.token;
}
}
// Return an empty string if no token is found
return "";
}