Modulo Administración #78
|
@ -21,7 +21,7 @@ const onRequestError = error => {
|
||||||
};
|
};
|
||||||
|
|
||||||
const onResponseError = error => {
|
const onResponseError = error => {
|
||||||
let message = '';
|
let message = error.message;
|
||||||
|
|
||||||
const response = error.response;
|
const response = error.response;
|
||||||
const responseData = response && response.data;
|
const responseData = response && response.data;
|
||||||
|
@ -35,12 +35,6 @@ const onResponseError = error => {
|
||||||
return Promise.reject(error);
|
return Promise.reject(error);
|
||||||
};
|
};
|
||||||
|
|
||||||
const jApiErrorInterceptor = error => {
|
|
||||||
if (error.message) {
|
|
||||||
notify(error.message, 'negative');
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
export default boot(({ app }) => {
|
export default boot(({ app }) => {
|
||||||
const userStore = useUserStore();
|
const userStore = useUserStore();
|
||||||
function addToken(config) {
|
function addToken(config) {
|
||||||
|
@ -53,7 +47,7 @@ export default boot(({ app }) => {
|
||||||
api.interceptors.response.use(response => response, onResponseError);
|
api.interceptors.response.use(response => response, onResponseError);
|
||||||
|
|
||||||
jApi.use(addToken);
|
jApi.use(addToken);
|
||||||
jApi.useErrorInterceptor(jApiErrorInterceptor);
|
jApi.useErrorInterceptor(onResponseError);
|
||||||
|
|
||||||
// for use inside Vue files (Options API) through this.$axios and this.$api
|
// for use inside Vue files (Options API) through this.$axios and this.$api
|
||||||
|
|
||||||
|
|
|
@ -37,7 +37,7 @@ const repeatPassword = ref('');
|
||||||
const passwordRequirements = ref(null);
|
const passwordRequirements = ref(null);
|
||||||
|
|
||||||
const formData = ref({
|
const formData = ref({
|
||||||
userId: userStore.user.id,
|
userId: userStore?.user?.id,
|
||||||
oldPassword: '',
|
oldPassword: '',
|
||||||
newPassword: ''
|
newPassword: ''
|
||||||
});
|
});
|
||||||
|
@ -102,12 +102,12 @@ onMounted(async () => {
|
||||||
<VnForm
|
<VnForm
|
||||||
ref="vnFormRef"
|
ref="vnFormRef"
|
||||||
:title="t('changePassword')"
|
:title="t('changePassword')"
|
||||||
:formInitialData="formData"
|
:form-initial-data="formData"
|
||||||
:saveFn="changePassword"
|
:save-fn="changePassword"
|
||||||
showBottomActions
|
show-bottom-actions
|
||||||
:defaultActions="false"
|
:default-actions="false"
|
||||||
style="max-width: 300px"
|
style="max-width: 300px"
|
||||||
@onDataSaved="onPasswordChanged()"
|
@on-data-saved="onPasswordChanged()"
|
||||||
>
|
>
|
||||||
<template #form>
|
<template #form>
|
||||||
<VnInput
|
<VnInput
|
||||||
|
@ -161,7 +161,13 @@ onMounted(async () => {
|
||||||
flat
|
flat
|
||||||
@click="passwordRequirementsDialogRef.show()"
|
@click="passwordRequirementsDialogRef.show()"
|
||||||
/>
|
/>
|
||||||
<QBtn :label="t('modify')" type="submit" rounded no-caps flat />
|
<QBtn
|
||||||
|
:label="t('modify')"
|
||||||
|
rounded
|
||||||
|
no-caps
|
||||||
|
flat
|
||||||
|
@click="vnFormRef.submit()"
|
||||||
|
/>
|
||||||
</template>
|
</template>
|
||||||
</VnForm>
|
</VnForm>
|
||||||
<QDialog ref="passwordRequirementsDialogRef">
|
<QDialog ref="passwordRequirementsDialogRef">
|
||||||
|
|
|
@ -20,7 +20,7 @@ const vnFormRef = ref(null);
|
||||||
const changePasswordFormDialog = ref(null);
|
const changePasswordFormDialog = ref(null);
|
||||||
const showChangePasswordForm = ref(false);
|
const showChangePasswordForm = ref(false);
|
||||||
const langOptions = ref([]);
|
const langOptions = ref([]);
|
||||||
const pks = computed(() => ({ id: userStore.user.id }));
|
const pks = computed(() => ({ id: userStore?.user?.id }));
|
||||||
const fetchConfigDataSql = {
|
const fetchConfigDataSql = {
|
||||||
query: `
|
query: `
|
||||||
SELECT u.id, u.name, u.email, u.nickname,
|
SELECT u.id, u.name, u.email, u.nickname,
|
||||||
|
@ -67,11 +67,11 @@ onMounted(() => fetchLanguagesSql());
|
||||||
<VnForm
|
<VnForm
|
||||||
ref="vnFormRef"
|
ref="vnFormRef"
|
||||||
:title="t('personalInformation')"
|
:title="t('personalInformation')"
|
||||||
:fetchFormDataSql="fetchConfigDataSql"
|
:fetch-form-data-sql="fetchConfigDataSql"
|
||||||
:pks="pks"
|
:pks="pks"
|
||||||
table="myUser"
|
table="myUser"
|
||||||
schema="account"
|
schema="account"
|
||||||
:defaultActions="false"
|
:default-actions="false"
|
||||||
>
|
>
|
||||||
<template #form="{ data }">
|
<template #form="{ data }">
|
||||||
<VnInput
|
<VnInput
|
||||||
|
@ -98,7 +98,7 @@ onMounted(() => fetchLanguagesSql());
|
||||||
option-label="name"
|
option-label="name"
|
||||||
option-value="code"
|
option-value="code"
|
||||||
:options="langOptions"
|
:options="langOptions"
|
||||||
@update:modelValue="vnFormRef.submit()"
|
@update:model-value="vnFormRef.submit()"
|
||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
</VnForm>
|
</VnForm>
|
||||||
|
|
|
@ -137,6 +137,7 @@ const onConfirmPay = async () => {
|
||||||
class="full-width"
|
class="full-width"
|
||||||
type="number"
|
type="number"
|
||||||
min="0"
|
min="0"
|
||||||
|
:max="debt * -1"
|
||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
</VnConfirm>
|
</VnConfirm>
|
||||||
|
|
Loading…
Reference in New Issue