mirror of
https://github.com/ClusterCockpit/cc-backend
synced 2026-04-03 14:37:29 +02:00
Restructure config frontend, add user jwt request
This commit is contained in:
@@ -1,18 +1,17 @@
|
||||
<script>
|
||||
import { Button } from "@sveltestrap/sveltestrap";
|
||||
import { fetchJwt } from "../../utils.js"
|
||||
|
||||
export let user;
|
||||
let jwt = "";
|
||||
|
||||
let jwt = "";
|
||||
function getUserJwt(username) {
|
||||
fetch(`/userconfig/jwt/?username=${username}`)
|
||||
.then((res) => res.text())
|
||||
.then((text) => {
|
||||
jwt = text;
|
||||
navigator.clipboard
|
||||
.writeText(text)
|
||||
.catch((reason) => console.error(reason));
|
||||
});
|
||||
const p = fetchJwt(username);
|
||||
p.then((content) => {
|
||||
jwt = content
|
||||
}).catch((error) => {
|
||||
console.error(`Could not get JWT: ${error}`);
|
||||
});
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user