mirror of
https://github.com/CzBiX/qb-web.git
synced 2026-04-15 10:49:50 +08:00
Fix login form
This commit is contained in:
@@ -22,7 +22,6 @@
|
||||
<add-form v-if="preferences" />
|
||||
<login-form
|
||||
v-if="needAuth"
|
||||
v-model="needAuth"
|
||||
/>
|
||||
<logs-dialog
|
||||
v-if="drawerOptions.showLogs"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<template>
|
||||
<v-dialog
|
||||
v-model="value"
|
||||
:value="true"
|
||||
persistent
|
||||
width="25em"
|
||||
>
|
||||
@@ -74,23 +74,20 @@ import api from '@/Api';
|
||||
import { useStore } from '@/store';
|
||||
|
||||
export default defineComponent({
|
||||
props: {
|
||||
value: Boolean,
|
||||
},
|
||||
setup(props, { emit }) {
|
||||
setup(_, { emit }) {
|
||||
const store = useStore();
|
||||
const data = reactive({
|
||||
valid: false,
|
||||
submitting: false,
|
||||
showPassword: false,
|
||||
loginError: null,
|
||||
baseUrl: location.href,
|
||||
baseUrl: store.getters.config.baseUrl || location.href,
|
||||
params: {
|
||||
username: null,
|
||||
password: null,
|
||||
username: '',
|
||||
password: '',
|
||||
},
|
||||
form: null,
|
||||
});
|
||||
const store = useStore();
|
||||
|
||||
const submit = async () => {
|
||||
if (data.submitting) {
|
||||
@@ -106,10 +103,14 @@ export default defineComponent({
|
||||
const resp = await api.login(data.params, data.baseUrl);
|
||||
|
||||
if (resp === 'Ok.') {
|
||||
api.changeBaseUrl(data.baseUrl);
|
||||
|
||||
store.commit('updateConfig', {
|
||||
key: 'baseUrl',
|
||||
value: data.baseUrl,
|
||||
});
|
||||
store.commit('updateNeedAuth', false);
|
||||
|
||||
emit('input', false);
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user