ใช้ axios

This commit is contained in:
setthawutttty 2025-02-21 17:56:26 +07:00
parent bdd055b8ae
commit b5e182e0e2

View file

@ -10,6 +10,7 @@ import { useQuasar } from 'quasar'
import { useCounterMixin } from '@/stores/mixin'
import { setAuthen, authenticated, setAuthenCheckin } from '@/plugins/auth'
import CustomComponent from '@/components/CustomDialog.vue'
import env from '@/api/index'
const router = useRouter()
@ -22,8 +23,8 @@ const { showLoader, hideLoader, messageError } = mixin
const username = ref<string>('')
async function onSubmit() {
showLoader()
http
.post(config.API.resetPassword, {
await axios
.post(`${env.API_URI}/org/keycloak/user/reset-password`, {
username: username.value,
})
.then((res) => {
@ -34,8 +35,17 @@ async function onSubmit() {
isFalse.value = true
}
})
.catch((e) => {
messageError($q, e)
.catch((err) => {
$q.dialog({
component: CustomComponent,
componentProps: {
title: `ข้อความแจ้งเตือน`,
message: `${err.response.data.message}`,
icon: 'warning',
color: 'red',
onlycancel: true,
},
})
})
.finally(() => {
hideLoader()