2019-05-14 17:22:17 -06:00
|
|
|
import { logIn, createAccount } from "./login";
|
2019-05-23 11:41:49 -06:00
|
|
|
import { setCookie } from "../StackOverflow/cookie";
|
2019-05-23 17:00:13 -06:00
|
|
|
import { changeDictionary } from "./dictionaryManagement";
|
2019-05-13 14:02:10 -06:00
|
|
|
|
|
|
|
export function setupLoginModal(modal) {
|
|
|
|
const closeElements = modal.querySelectorAll('.modal-background, .close-button');
|
|
|
|
Array.from(closeElements).forEach(close => {
|
|
|
|
close.addEventListener('click', () => {
|
|
|
|
modal.parentElement.removeChild(modal);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
document.getElementById('loginSubmit').addEventListener('click', logIn);
|
2019-05-14 17:22:17 -06:00
|
|
|
document.getElementById('createAccountSubmit').addEventListener('click', createAccount);
|
2019-05-17 12:23:40 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
export function setupLogoutButton(logoutButton) {
|
|
|
|
logoutButton.addEventListener('click', () => {
|
2019-05-23 11:41:49 -06:00
|
|
|
setCookie('token', '', -1);
|
2019-05-17 12:23:40 -06:00
|
|
|
window.location.reload();
|
|
|
|
});
|
2019-05-21 18:57:29 -06:00
|
|
|
}
|
2019-05-23 17:00:13 -06:00
|
|
|
|
|
|
|
export function setupChangeDictionary() {
|
|
|
|
document.getElementById('accountSettingsChangeDictionary').addEventListener('change', changeDictionary);
|
|
|
|
}
|