no message

This commit is contained in:
DESKTOP-1R2VSQH\Lenovo ThinkPad E490 2023-07-25 09:04:49 +07:00
parent 5d2fdf254d
commit a50ac34978
3 changed files with 121 additions and 10 deletions

View file

@ -1,11 +1,13 @@
<script setup lang="ts">
import { ref } from "vue";
import { ref, watch } from "vue";
import http from "@/plugins/http";
import config from "@/app.config";
import { useCounterMixin } from "@/stores/mixin";
import { useQuasar } from "quasar";
const $q = useQuasar(); // noti quasar
const mixin = useCounterMixin();
const {} = mixin;
const { messageError, success } = mixin;
const modal = ref<boolean>(false);
@ -98,6 +100,21 @@ const rows = ref<any>([
},
]);
const filter = ref<string>("");
watch(modal, () => {
if (modal.value === true) {
fecthProfile();
}
});
const fecthProfile = async () => {
await http
.get(config.API.getprofileRetire("1234"))
.then((res) => {
console.log(res);
})
.catch((e) => {
messageError($q, e);
});
};
const clickAdd = () => {
$q.dialog({
title: "ยืนยันการเพิ่มข้อมูล",
@ -110,6 +127,17 @@ const clickAdd = () => {
})
.onOk(async () => {
console.log("เพิ่มข้อมูล");
await http
.put(config.API.profileRetire("123"))
.then(() => {
success($q, "เพิ่มข้อมูลสำเร็จ");
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
fecthProfile();
});
})
.onCancel(() => {})
.onDismiss(() => {});