2020-08-07 12:23:59 +02:00
|
|
|
// -- 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";
|
2020-08-13 12:12:29 +02:00
|
|
|
import { loadMatomo } from "./tools/matomo.js";
|
2020-08-07 12:23:59 +02:00
|
|
|
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 du compte en haut
|
|
|
|
const user=getLocaly("user", true);
|
|
|
|
updateAccountLink(user.status, configTemplate);
|
|
|
|
}
|
|
|
|
else
|
2020-08-13 12:12:29 +02:00
|
|
|
loadMatomo();
|
2020-08-07 12:23:59 +02:00
|
|
|
}
|
|
|
|
catch(e)
|
|
|
|
{
|
|
|
|
console.error(e);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
initialise();
|