mirror of
https://code.lenaisten.de/Lenaisten/advent22.git
synced 2024-11-23 00:03:07 +00:00
more Credentials cleanup
This commit is contained in:
parent
de5fff311c
commit
6e8b6549ea
3 changed files with 9 additions and 4 deletions
|
@ -11,6 +11,7 @@
|
|||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import { Credentials } from "@/lib/api";
|
||||
import { Options, Vue } from "vue-class-component";
|
||||
|
||||
import BulmaButton from "./bulma/Button.vue";
|
||||
|
@ -38,7 +39,7 @@ export default class extends Vue {
|
|||
public on_click() {
|
||||
if (this.modelValue) {
|
||||
// logout
|
||||
this.$advent22.set_api_auth();
|
||||
this.$advent22.clear_api_auth();
|
||||
this.$emit("update:modelValue", false);
|
||||
} else {
|
||||
// show login modal
|
||||
|
@ -47,9 +48,9 @@ export default class extends Vue {
|
|||
}
|
||||
}
|
||||
|
||||
public on_submit(username: string, password: string) {
|
||||
public on_submit(creds: Credentials) {
|
||||
this.modal_visible = false;
|
||||
this.$advent22.api_auth = [username, password];
|
||||
this.$advent22.api_auth = creds;
|
||||
|
||||
this.$advent22
|
||||
.api_get<boolean>("admin/is_admin")
|
||||
|
|
|
@ -89,7 +89,7 @@ export default class extends Vue {
|
|||
}
|
||||
|
||||
public submit(): void {
|
||||
this.$emit("submit", this.username, this.password);
|
||||
this.$emit("submit", [this.username, this.password]);
|
||||
}
|
||||
|
||||
public cancel(): void {
|
||||
|
|
|
@ -94,6 +94,10 @@ export class Advent22 {
|
|||
this._api_auth = creds;
|
||||
}
|
||||
|
||||
public clear_api_auth(): void {
|
||||
this.set_api_auth();
|
||||
}
|
||||
|
||||
public set api_auth(creds: Credentials) {
|
||||
this.set_api_auth(creds);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue