WikiLerni/front/src/index.js

36 lines
1002 B
JavaScript

// -- SCRIPT DE BASE APPELÉ DANS LES PAGES TYPE ACCUEIL DU SITE
// Fichier de configuration tirés du backend :
import { availableLangs, theme } from "../../config/instance.js";
const lang=availableLangs[0];
const configTemplate = require("../../views/"+theme+"/config/"+lang+".js");
import { getLocaly } from "./tools/clientstorage.js";
import { helloDev, updateAccountLink } from "./tools/everywhere.js";
import { loadMatomo } from "./tools/matomo.js";
import { checkSession } from "./tools/users.js";
helloDev();
// Test de connexion de l'utilisateur pour adapter le lien du menu...
const initialise = async () =>
{
try
{
const isConnected=await checkSession();
if(isConnected)
{
// on change le lien d'accès au compte
const user=getLocaly("user", true);
updateAccountLink(user.status, configTemplate);
}
else
loadMatomo();
}
catch(e)
{
console.error(e);
}
}
initialise();