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>
|
</template>
|
||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
|
import { Credentials } from "@/lib/api";
|
||||||
import { Options, Vue } from "vue-class-component";
|
import { Options, Vue } from "vue-class-component";
|
||||||
|
|
||||||
import BulmaButton from "./bulma/Button.vue";
|
import BulmaButton from "./bulma/Button.vue";
|
||||||
|
@ -38,7 +39,7 @@ export default class extends Vue {
|
||||||
public on_click() {
|
public on_click() {
|
||||||
if (this.modelValue) {
|
if (this.modelValue) {
|
||||||
// logout
|
// logout
|
||||||
this.$advent22.set_api_auth();
|
this.$advent22.clear_api_auth();
|
||||||
this.$emit("update:modelValue", false);
|
this.$emit("update:modelValue", false);
|
||||||
} else {
|
} else {
|
||||||
// show login modal
|
// 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.modal_visible = false;
|
||||||
this.$advent22.api_auth = [username, password];
|
this.$advent22.api_auth = creds;
|
||||||
|
|
||||||
this.$advent22
|
this.$advent22
|
||||||
.api_get<boolean>("admin/is_admin")
|
.api_get<boolean>("admin/is_admin")
|
||||||
|
|
|
@ -89,7 +89,7 @@ export default class extends Vue {
|
||||||
}
|
}
|
||||||
|
|
||||||
public submit(): void {
|
public submit(): void {
|
||||||
this.$emit("submit", this.username, this.password);
|
this.$emit("submit", [this.username, this.password]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public cancel(): void {
|
public cancel(): void {
|
||||||
|
|
|
@ -94,6 +94,10 @@ export class Advent22 {
|
||||||
this._api_auth = creds;
|
this._api_auth = creds;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public clear_api_auth(): void {
|
||||||
|
this.set_api_auth();
|
||||||
|
}
|
||||||
|
|
||||||
public set api_auth(creds: Credentials) {
|
public set api_auth(creds: Credentials) {
|
||||||
this.set_api_auth(creds);
|
this.set_api_auth(creds);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue