first commit + add fe component vue accone
This commit is contained in:
37
libs/one_auth.js
Normal file
37
libs/one_auth.js
Normal file
@@ -0,0 +1,37 @@
|
||||
function one_verif( url_redir ) {
|
||||
let verif = async function (token) {
|
||||
try {
|
||||
var resp = await axios.post(BASE_URL + '/one-api/v2/verif/do',
|
||||
{ token: token });
|
||||
if (resp.status != 200) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: resp.statusText
|
||||
};
|
||||
}
|
||||
let data = resp.data;
|
||||
return data;
|
||||
} catch (e) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: e.message
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
let x = async () => {
|
||||
try {
|
||||
let resp = await verif(window.one_token())
|
||||
if (resp.status != "OK") {
|
||||
window.localStorage.removeItem("token")
|
||||
window.localStorage.removeItem("user")
|
||||
} else {
|
||||
location.replace(url_redir)
|
||||
}
|
||||
} catch (e) {
|
||||
}
|
||||
}
|
||||
x()
|
||||
// window.location = urllogout
|
||||
}
|
||||
window.one_verif = one_verif
|
||||
Reference in New Issue
Block a user