Skip to content

Commit 3757552

Browse files
committed
Console log error in development
1 parent 8c14a36 commit 3757552

File tree

4 files changed

+3720
-5916
lines changed

4 files changed

+3720
-5916
lines changed

components/Cart/ShowCartContents.vue

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
/* eslint-disable no-console */
12
<template>
23
<div>
34
<LoadingSpinner v-if="loading" />
@@ -90,6 +91,10 @@ export default {
9091
},
9192
error(error) {
9293
this.remoteError = error
94+
// Logs out an error in the console if we are in development mode
95+
if (process.env.NODE_ENV === 'development') {
96+
console.error(error)
97+
}
9398
},
9499
},
95100
},

components/Header/Cart.vue

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,13 @@ export default {
6363
},
6464
error(error) {
6565
this.remoteError = error
66-
if (!localStorage.getItem('woo-session')) {
66+
// Logs out an error in the console if we are in development mode
67+
if (process.env.NODE_ENV === 'development') {
68+
console.error(error)
69+
}
70+
// Check if we are in the browser before checking localStorage
71+
// Will refresh the page to refetch the session from WooCommerce
72+
if (process.browser && !localStorage.getItem('woo-session')) {
6773
window.location.reload(true)
6874
}
6975
},

0 commit comments

Comments
 (0)