Skip to content

Commit ea66b0d

Browse files
committed
Early return
1 parent 20affac commit ea66b0d

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

nuxt3/components/Layout/LayoutCart.vue

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -46,16 +46,18 @@ const { data, error, pending, execute } = await useAsyncQuery(GET_CART_QUERY, {
4646
})
4747
4848
const updateCartDisplay = () => {
49-
if (data) {
50-
cartLength.value = data.value.cart.contents.nodes.reduce(
51-
(accumulator, argument) => accumulator + argument.quantity,
52-
0
53-
)
49+
if (!data) {
50+
return
51+
}
52+
53+
cartLength.value = data.value.cart.contents.nodes.reduce(
54+
(accumulator, argument) => accumulator + argument.quantity,
55+
0
56+
)
5457
55-
subTotal.value = data.value.cart.total
58+
subTotal.value = data.value.cart.total
5659
57-
remoteError.value = error
58-
}
60+
remoteError.value = error
5961
}
6062
6163
setInterval(() => {

0 commit comments

Comments
 (0)