add: user associations
This commit is contained in:
parent
50319f9124
commit
675b3e4ee6
11 changed files with 131 additions and 9 deletions
|
@ -455,6 +455,26 @@
|
|||
});
|
||||
|
||||
// token switcher
|
||||
self.define("append_associations", (_, tokens) => {
|
||||
fetch("/api/v1/auth/user/me/append_associations", {
|
||||
method: "PUT",
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
body: JSON.stringify({
|
||||
tokens,
|
||||
}),
|
||||
})
|
||||
.then((res) => res.json())
|
||||
.then((res) => {
|
||||
if (res.ok) {
|
||||
console.log("associations sent");
|
||||
} else {
|
||||
console.warn(res.message);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
self.define(
|
||||
"set_login_account_tokens",
|
||||
({ $ }, value) => {
|
||||
|
@ -474,7 +494,10 @@
|
|||
return;
|
||||
}
|
||||
|
||||
window.location.href = `/api/v1/auth/token?token=${token}`;
|
||||
self.append_associations([token]);
|
||||
setTimeout(() => {
|
||||
window.location.href = `/api/v1/auth/token?token=${token}`;
|
||||
}, 150);
|
||||
});
|
||||
|
||||
self.define("remove_token", async (_, username) => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue