Skip to content

Commit 45b6a0b

Browse files
committed
v0.5.8
1 parent 4a63060 commit 45b6a0b

File tree

11 files changed

+53
-31
lines changed

11 files changed

+53
-31
lines changed

assets/img/remove-icon.svg

Lines changed: 1 addition & 3 deletions
Loading

lib/components/molecules/cart-product-table-row/cart-product-table-row.vue

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,6 @@
6161
</vf-m-tr>
6262
</template>
6363
<script lang="ts" setup>
64-
import { mdiTrashCanOutline } from "@mdi/js";
6564
import { PropType, computed } from "vue";
6665
import { CartProduct } from "vuefront-api";
6766
import placeholder from "../../../../assets/img/placeholder.png";

lib/components/organisms/cart/cart.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
</vf-m-tbody>
2828
<vf-m-tfoot>
2929
<vf-m-tr>
30-
<vf-m-td colspan="5" class="text-right">
30+
<vf-m-td :colspan="5" class="text-right">
3131
<vf-m-cart-footer :cart="cart" class="inline-block" />
3232
</vf-m-td>
3333
</vf-m-tr>

lib/components/organisms/form/form.vue

Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,7 @@
1313
<slot name="sub-title"></slot>
1414
</div>
1515
</div>
16-
17-
<vf-a-alert
18-
v-if="error.message || errors.length > 0"
19-
show
20-
color="info"
21-
v-html="error.message || errors[0].$message"
22-
/>
16+
<vf-a-alert v-if="hasError" show color="info" v-html="getError" />
2317

2418
<slot></slot>
2519

@@ -34,7 +28,7 @@
3428
import { computed, PropType } from "vue";
3529
import { useStore } from "vuex";
3630
const emits = defineEmits(["submit", "reset"]);
37-
defineProps({
31+
const props = defineProps({
3832
errors: {
3933
type: Array as PropType<any[]>,
4034
default() {
@@ -64,4 +58,23 @@ const onReset = (e: Event) => {
6458
e.preventDefault();
6559
emits("reset", e);
6660
};
61+
62+
const stripTags = (str: string) => {
63+
return str.replace(/<\/?[^>]+>/gi, " ");
64+
};
65+
66+
const hasError = computed(() => error.value || props.errors.length > 0);
67+
const getError = computed(() => {
68+
let result = "";
69+
70+
if (error.value?.message) {
71+
result = stripTags(error.value.message);
72+
} else if (error.value) {
73+
result = stripTags(error.value);
74+
} else if (props.errors[0].$message) {
75+
result = props.errors[0].$message;
76+
}
77+
78+
return result;
79+
});
6780
</script>

lib/store/common/apollo/apollo.mjs.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "vuefront",
3-
"version": "0.5.7",
3+
"version": "0.5.8",
44
"description": "vuefront",
55
"files": [
66
"lib",
@@ -58,7 +58,7 @@
5858
"@types/faker": "^6.6.8",
5959
"@types/isomorphic-form-data": "^2.0.0",
6060
"@types/lodash": "^4.14.178",
61-
"@types/node": "^17.0.12",
61+
"@types/node": "^17.0.13",
6262
"@types/omit-deep-lodash": "^1.1.1",
6363
"@typescript-eslint/eslint-plugin": "^5.10.1",
6464
"@typescript-eslint/parser": "^5.10.1",

src/components/molecules/cart-product-table-row/cart-product-table-row.vue

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,6 @@
6161
</vf-m-tr>
6262
</template>
6363
<script lang="ts" setup>
64-
import { mdiTrashCanOutline } from "@mdi/js";
6564
import { PropType, computed } from "vue";
6665
import { CartProduct } from "vuefront-api";
6766
import placeholder from "../../../../assets/img/placeholder.png";

src/components/organisms/cart/cart.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
</vf-m-tbody>
2828
<vf-m-tfoot>
2929
<vf-m-tr>
30-
<vf-m-td colspan="5" class="text-right">
30+
<vf-m-td :colspan="5" class="text-right">
3131
<vf-m-cart-footer :cart="cart" class="inline-block" />
3232
</vf-m-td>
3333
</vf-m-tr>

src/components/organisms/form/form.vue

Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,7 @@
1313
<slot name="sub-title"></slot>
1414
</div>
1515
</div>
16-
17-
<vf-a-alert
18-
v-if="error.message || errors.length > 0"
19-
show
20-
color="info"
21-
v-html="error.message || errors[0].$message"
22-
/>
16+
<vf-a-alert v-if="hasError" show color="info" v-html="getError" />
2317

2418
<slot></slot>
2519

@@ -34,7 +28,7 @@
3428
import { computed, PropType } from "vue";
3529
import { useStore } from "vuex";
3630
const emits = defineEmits(["submit", "reset"]);
37-
defineProps({
31+
const props = defineProps({
3832
errors: {
3933
type: Array as PropType<any[]>,
4034
default() {
@@ -64,4 +58,23 @@ const onReset = (e: Event) => {
6458
e.preventDefault();
6559
emits("reset", e);
6660
};
61+
62+
const stripTags = (str: string) => {
63+
return str.replace(/<\/?[^>]+>/gi, " ");
64+
};
65+
66+
const hasError = computed(() => error.value || props.errors.length > 0);
67+
const getError = computed(() => {
68+
let result = "";
69+
70+
if (error.value?.message) {
71+
result = stripTags(error.value.message);
72+
} else if (error.value) {
73+
result = stripTags(error.value);
74+
} else if (props.errors[0].$message) {
75+
result = props.errors[0].$message;
76+
}
77+
78+
return result;
79+
});
6780
</script>

src/store/common/apollo/apollo.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ export const actions: ActionTree<State, RootState> = {
4949
async mutate({ commit }, options) {
5050
try {
5151
const variables = omitDeepLodash(options.variables, "__typename");
52-
const res = await (this.$vfapollo as any).mutate({
52+
const res = await this.$vfapollo.mutate({
5353
...options,
5454
variables,
5555
});

0 commit comments

Comments
 (0)