角色權限 : 新增錯誤提示功能,當更新失敗時顯示錯誤訊息
This commit is contained in:
parent
59132a9810
commit
5808c8ddc3
@ -8,10 +8,11 @@ import {
|
|||||||
getAccountRoleAuthList,
|
getAccountRoleAuthList,
|
||||||
postAccountRole,
|
postAccountRole,
|
||||||
} from "@/apis/account";
|
} from "@/apis/account";
|
||||||
import { defineProps, onMounted, ref, watch, computed } from "vue";
|
import { defineProps, onMounted, ref, watch, computed, inject } from "vue";
|
||||||
import useActiveBtn from "@/hooks/useActiveBtn";
|
import useActiveBtn from "@/hooks/useActiveBtn";
|
||||||
import { useI18n } from "vue-i18n";
|
import { useI18n } from "vue-i18n";
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
|
const { openToast } = inject("app_toast");
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
selectedRole: Object,
|
selectedRole: Object,
|
||||||
cancelModal: Function,
|
cancelModal: Function,
|
||||||
@ -120,8 +121,12 @@ const onOk = async () => {
|
|||||||
...props.selectedRole,
|
...props.selectedRole,
|
||||||
...postData,
|
...postData,
|
||||||
});
|
});
|
||||||
props.update();
|
if (res.isSuccess) {
|
||||||
onCancel();
|
props.update();
|
||||||
|
onCancel();
|
||||||
|
} else {
|
||||||
|
openToast("error", res.msg, "#role_auth_modal");
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
watch(
|
watch(
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user