WikiLerni/front/src/deconnection.js

44 lines
1.3 KiB
JavaScript

// -- GESTION DE LA PAGE DE DÉCONNEXION
/// On se contente ici de supprimer la session stockée côté client
// Fichier de configuration côté client :
import { apiUrl, availableLangs, theme } from "../../config/instance.js";
const lang=availableLangs[0];
const configFrontEnd = require("../../views/"+theme+"/config/"+lang+".js");
// Importation des fonctions utile au script :
import { removeLocaly } from "./tools/clientstorage.js";
import { addElement } from "./tools/dom.js";
import { helloDev } from "./tools/everywhere.js";
import { getConfig } from "./tools/users.js";
// Dictionnaires :
const txt = require("../../lang/"+lang+"/general");
const txtUsers = require("../../lang/"+lang+"/user");
helloDev();
const divResponse = document.getElementById("response");
let config;
const initialise = async () =>
{
try
{
config = await getConfig();
if(!config)
addElement(divResponse, "p", txt.serverError, "", ["error"]);
else
{
removeLocaly("user");
removeLocaly("url");
removeLocaly("message");
addElement(divResponse, "p", txtUsers.byebyeMessage, "", ["success"]);
}
}
catch(e)
{
addElement(divResponse, "p", txt.serverError, "", ["error"]);
}
}
initialise();