Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(UForm): success message not rendered #105

Merged
merged 1 commit into from
Aug 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion components/base/UForm.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<script setup lang="ts">
import type { Form } from '~/types';
import type { FormError } from '@nuxt/ui/dist/runtime/types';

Check failure on line 3 in components/base/UForm.vue

View workflow job for this annotation

GitHub Actions / Typecheck

Cannot find module '@nuxt/ui/dist/runtime/types' or its corresponding type declarations.

const props = defineProps<{
form: Form;
Expand All @@ -27,7 +27,7 @@

try {
await useDirectus(
createItem('inbox', {

Check failure on line 30 in components/base/UForm.vue

View workflow job for this annotation

GitHub Actions / Typecheck

Argument of type 'string' is not assignable to parameter of type 'never'.
data: formData,
form: props.form.id,
}),
Expand Down Expand Up @@ -58,7 +58,8 @@
<div class="mb-4">
<VAlert v-if="error" type="error">Oops! {{ error }}</VAlert>
<VAlert v-if="form.on_success === 'message' && success" type="success">
{{ form.success_message ?? 'Success! Your form has been submitted.' }}
<div v-if="form.success_message" v-dompurify-html="form.success_message"></div>
<p v-else>Success! Your form has been submitted.</p>
</VAlert>
</div>
<div>
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@
"stripe": "^16.5.0",
"uuid": "^10.0.0",
"v-perfect-signature": "^1.4.0",
"vue": "^3.4.34"
"vue": "^3.4.34",
"vue-dompurify-html": "^5.1.0"
},
"packageManager": "[email protected]",
"engines": {
Expand Down
5 changes: 5 additions & 0 deletions plugins/dompurify-html.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import VueDOMPurifyHTML from 'vue-dompurify-html';

export default defineNuxtPlugin((nuxtApp) => {
nuxtApp.vueApp.use(VueDOMPurifyHTML);
});
18 changes: 18 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading