master
parent
9e5474bf28
commit
7716a7877e
|
|
@ -40,7 +40,7 @@
|
||||||
|
|
||||||
var user = loginInfo();
|
var user = loginInfo();
|
||||||
if (user != "") {
|
if (user != "") {
|
||||||
location.href = '/';
|
location.href = '/index.html';
|
||||||
}
|
}
|
||||||
|
|
||||||
function login(obj) {
|
function login(obj) {
|
||||||
|
|
@ -54,10 +54,11 @@
|
||||||
} else {
|
} else {
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type : 'post',
|
type : 'post',
|
||||||
url : '/sys/login',
|
url : '/login',
|
||||||
data : $("#login-form").serialize(),
|
data : $("#login-form").serialize(),
|
||||||
success : function() {
|
success : function(data) {
|
||||||
location.href = '/';
|
localStorage.setItem("token", data.token);
|
||||||
|
location.href = '/index.html';
|
||||||
},
|
},
|
||||||
error : function(xhr, textStatus, errorThrown) {
|
error : function(xhr, textStatus, errorThrown) {
|
||||||
var msg = xhr.responseText;
|
var msg = xhr.responseText;
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,8 @@
|
||||||
$.ajaxSetup({
|
$.ajaxSetup({
|
||||||
cache : false,
|
cache : false,
|
||||||
|
headers : {
|
||||||
|
"token" : localStorage.getItem("token")
|
||||||
|
}
|
||||||
error : function(xhr, textStatus, errorThrown) {
|
error : function(xhr, textStatus, errorThrown) {
|
||||||
var msg = xhr.responseText;
|
var msg = xhr.responseText;
|
||||||
var response = JSON.parse(msg);
|
var response = JSON.parse(msg);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue