show loading icon
This commit is contained in:
@@ -6,7 +6,9 @@
|
|||||||
:back-link="{ name: 'dashboard-article-list' }"
|
:back-link="{ name: 'dashboard-article-list' }"
|
||||||
back-title="Back to Articles" />
|
back-title="Back to Articles" />
|
||||||
<div class="max-w-7xl mx-auto mt-8 px-8">
|
<div class="max-w-7xl mx-auto mt-8 px-8">
|
||||||
|
<SMLoading v-if="pageLoading" />
|
||||||
<SMForm
|
<SMForm
|
||||||
|
v-else
|
||||||
:model-value="form"
|
:model-value="form"
|
||||||
@submit="handleSubmit"
|
@submit="handleSubmit"
|
||||||
@failed-validation="handleFailValidation">
|
@failed-validation="handleFailValidation">
|
||||||
@@ -65,11 +67,13 @@ import SMMastHead from "../../components/SMMastHead.vue";
|
|||||||
import SMPageStatus from "../../components/SMPageStatus.vue";
|
import SMPageStatus from "../../components/SMPageStatus.vue";
|
||||||
import { userHasPermission } from "../../helpers/utils";
|
import { userHasPermission } from "../../helpers/utils";
|
||||||
import SMSelectImage from "../../components/SMSelectImage.vue";
|
import SMSelectImage from "../../components/SMSelectImage.vue";
|
||||||
|
import SMLoading from "../../components/SMLoading.vue";
|
||||||
|
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const userStore = useUserStore();
|
const userStore = useUserStore();
|
||||||
let pageError = ref(200);
|
let pageError = ref(200);
|
||||||
|
const pageLoading = ref(false);
|
||||||
const authors = ref({});
|
const authors = ref({});
|
||||||
const attachments = ref([]);
|
const attachments = ref([]);
|
||||||
const pageHeading = route.params.id ? "Edit Article" : "Create Article";
|
const pageHeading = route.params.id ? "Edit Article" : "Create Article";
|
||||||
@@ -132,7 +136,7 @@ const updateSlug = async () => {
|
|||||||
const loadData = async () => {
|
const loadData = async () => {
|
||||||
try {
|
try {
|
||||||
if (route.params.id) {
|
if (route.params.id) {
|
||||||
form.loading(true);
|
pageLoading.value = true;
|
||||||
let result = await api.get({
|
let result = await api.get({
|
||||||
url: "/articles/{id}",
|
url: "/articles/{id}",
|
||||||
params: {
|
params: {
|
||||||
@@ -168,7 +172,7 @@ const loadData = async () => {
|
|||||||
} catch (error) {
|
} catch (error) {
|
||||||
pageError.value = error.status;
|
pageError.value = error.status;
|
||||||
} finally {
|
} finally {
|
||||||
form.loading(false);
|
pageLoading.value = false;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user