ใช้ axios
This commit is contained in:
parent
bdd055b8ae
commit
b5e182e0e2
1 changed files with 14 additions and 4 deletions
|
|
@ -10,6 +10,7 @@ import { useQuasar } from 'quasar'
|
||||||
import { useCounterMixin } from '@/stores/mixin'
|
import { useCounterMixin } from '@/stores/mixin'
|
||||||
import { setAuthen, authenticated, setAuthenCheckin } from '@/plugins/auth'
|
import { setAuthen, authenticated, setAuthenCheckin } from '@/plugins/auth'
|
||||||
import CustomComponent from '@/components/CustomDialog.vue'
|
import CustomComponent from '@/components/CustomDialog.vue'
|
||||||
|
|
||||||
import env from '@/api/index'
|
import env from '@/api/index'
|
||||||
|
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
|
|
@ -22,8 +23,8 @@ const { showLoader, hideLoader, messageError } = mixin
|
||||||
const username = ref<string>('')
|
const username = ref<string>('')
|
||||||
async function onSubmit() {
|
async function onSubmit() {
|
||||||
showLoader()
|
showLoader()
|
||||||
http
|
await axios
|
||||||
.post(config.API.resetPassword, {
|
.post(`${env.API_URI}/org/keycloak/user/reset-password`, {
|
||||||
username: username.value,
|
username: username.value,
|
||||||
})
|
})
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
|
|
@ -34,8 +35,17 @@ async function onSubmit() {
|
||||||
isFalse.value = true
|
isFalse.value = true
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.catch((e) => {
|
.catch((err) => {
|
||||||
messageError($q, e)
|
$q.dialog({
|
||||||
|
component: CustomComponent,
|
||||||
|
componentProps: {
|
||||||
|
title: `ข้อความแจ้งเตือน`,
|
||||||
|
message: `${err.response.data.message}`,
|
||||||
|
icon: 'warning',
|
||||||
|
color: 'red',
|
||||||
|
onlycancel: true,
|
||||||
|
},
|
||||||
|
})
|
||||||
})
|
})
|
||||||
.finally(() => {
|
.finally(() => {
|
||||||
hideLoader()
|
hideLoader()
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue