les petites modifs qui étaient pas push

This commit is contained in:
johan 2022-12-20 21:56:06 +01:00
parent b78267692d
commit 0b2f670949
2 changed files with 19 additions and 5 deletions

View file

@ -98,7 +98,6 @@
<script src="https://code.jquery.com/jquery-3.6.1.min.js" integrity="sha256-o88AwQnZB+VDvE9tvIXrMQaPlFFSUTR+nldQm1LuPXQ=" crossorigin="anonymous"></script>
<script src="https://unpkg.com/typeit@8.7.0/dist/index.umd.js"></script>
<script src="https://cdn.jsdelivr.net/npm/js-cookie@3.0.1/dist/js.cookie.min.js"></script>
<script src="js/main.js" defer></script>
<script src="js/anim.js" defer></script>
</body>

View file

@ -38,17 +38,32 @@ $(window).on("load", function() {
$("#login-form").submit(function (e) {
e.preventDefault();
var data = JSON.stringify({
username: $("#login").val(),
user: $("#login").val(),
password: $("#password").val()
});
$.post(base_url + "login", data, function (data) {
console.log(data);
$.ajax({
type: "POST",
url: base_url + "login",
data: data,
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function (data) {
if(data.success) {
localStorage.setItem("token", data.token);
localStorage.setItem("user", data.user);
show_page('#demande-page');
} else {
}
}
});
});
$("#prank-button").click(function () {
if(Cookies.get('token')) {
if(localStorage.getItem('token')) {
show_page('#demande-page');
}
else {