mirror of
https://github.com/NapNeko/NapCatQQ.git
synced 2024-11-21 09:36:35 +00:00
fix:webui login
This commit is contained in:
parent
0c7dfe2af4
commit
1c7d9c3513
@ -11,7 +11,6 @@
|
|||||||
<link rel="stylesheet" href="./assets/style.css" />
|
<link rel="stylesheet" href="./assets/style.css" />
|
||||||
<link rel="stylesheet" href="./assets/color.css" />
|
<link rel="stylesheet" href="./assets/color.css" />
|
||||||
<!-- 脚手架 -->
|
<!-- 脚手架 -->
|
||||||
<script src="https://unpkg.com/axios/dist/axios.min.js"></script>
|
|
||||||
<!-- 渲染脚本 -->
|
<!-- 渲染脚本 -->
|
||||||
<script>
|
<script>
|
||||||
async function InitWebUi() {
|
async function InitWebUi() {
|
||||||
|
@ -85,25 +85,29 @@
|
|||||||
let data = "";
|
let data = "";
|
||||||
|
|
||||||
try {
|
try {
|
||||||
response = await fetch('/api/auth/login', {
|
let response = await fetch('/api/auth/login', {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: {
|
headers: {
|
||||||
'Content-Type': 'application/json'
|
'Content-Type': 'application/json'
|
||||||
},
|
},
|
||||||
body: JSON.stringify({ token: tokenInput.value })
|
body: JSON.stringify({ token: tokenInput.value })
|
||||||
});
|
});
|
||||||
let responseJson = response.json();
|
const responseJson = await response.json();
|
||||||
let retCode = responseJson.code;
|
let retCode = responseJson.code;
|
||||||
if (retCode === 0) {
|
if (retCode === 0) {
|
||||||
//登录成功
|
//登录成功
|
||||||
let retCredential = responseJson.data.Credential;
|
let retCredential = responseJson.data.Credential;
|
||||||
localStorage.setItem('auth', retCredential);
|
localStorage.setItem('auth', retCredential);
|
||||||
window.location.href = './config.html';
|
window.location.href = './config.html';
|
||||||
|
alert("登录成功即将跳转");
|
||||||
|
} else {
|
||||||
|
console.log(responseJson.message);
|
||||||
|
alert(responseJson.message);
|
||||||
}
|
}
|
||||||
alert("登录失败,数据异常");
|
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
alert("登录失败");
|
alert("登录失败");
|
||||||
console.log("请求异常",e);
|
console.log("请求异常", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user