Skip to content

Commit

Permalink
add publish and unpublish to dashboard items
Browse files Browse the repository at this point in the history
  • Loading branch information
PhilReinking committed Nov 9, 2023
1 parent 19ceb23 commit fd2ad0e
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions resources/js/components/Dashboard/FormListItem.vue
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,22 @@
class="block w-full text-left"
label="Settings"
/>
<D9MenuLink
v-if="!form.is_published && !form.is_trashed"
as="button"
type="button"
class="block w-full text-left"
label="Publish Form"
@click="publishForm"
/>
<D9MenuLink
v-if="form.is_published && !form.is_trashed"
as="button"
type="button"
class="block w-full text-left"
label="Unpublish Form"
@click="unpublishForm"
/>
<D9MenuLink
v-if="!form.is_published && !form.is_trashed"
as="button"
Expand Down Expand Up @@ -165,7 +181,9 @@ import {
callDeleteForeverForm,
callDeleteForm,
callDuplicateForm,
callPublishForm,
callRestoreForm,
callUnpublishForm,
} from "@/api/forms";
const props = defineProps<{
Expand Down Expand Up @@ -204,6 +222,18 @@ const duplicateForm = async () => {
});
};
const publishForm = async () => {
await callPublishForm(props.form);
window.location.reload();
};
const unpublishForm = async () => {
await callUnpublishForm(props.form)
window.location.reload();
};
const restoreForm = async () => {
const restored = await callRestoreForm(props.form);
Expand Down

0 comments on commit fd2ad0e

Please sign in to comment.