no message
This commit is contained in:
parent
5d2fdf254d
commit
a50ac34978
3 changed files with 121 additions and 10 deletions
|
|
@ -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(() => {});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue