Skip to content

Commit 7c5ec05

Browse files
committed
Refactor code
1 parent 36ded01 commit 7c5ec05

File tree

4 files changed

+10
-4
lines changed

4 files changed

+10
-4
lines changed

components/Products/ProductsShowAll.vue

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,10 @@
5757
import FETCH_ALL_PRODUCTS_QUERY from "@/apollo/queries/FETCH_ALL_PRODUCTS_QUERY.gql";
5858
import { filteredVariantPrice } from "@/utils/functions";
5959
60+
const config = useRuntimeConfig();
61+
6062
const productImage = (product) =>
61-
product.image ? product.image.sourceUrl : process.env.placeholderSmallImage;
63+
product.image ? product.image.sourceUrl : config.placeholderImage;
6264
6365
const variables = { limit: 99 };
6466
const { data } = await useAsyncQuery(FETCH_ALL_PRODUCTS_QUERY, variables);

components/common/CommonButton.vue

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,9 @@
2727
</template>
2828

2929
<script setup>
30-
/* Usage:
31-
* <CommonButton @common-button-click="function name" isLoading="true">Common button</CommonButton>
30+
/*
31+
* Usage:
32+
* <CommonButton @common-button-click="functionName" isLoading="true">Common button</CommonButton>
3233
*/
3334
3435
defineEmits(["CommonButtonClick"]);

nuxt.config.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ export default defineNuxtConfig({
1616
runtimeConfig: {
1717
public: {
1818
graphqlURL: process.env.PUBLIC_GRAPHQL_URL,
19+
indexName: process.env.PUBLIC_ALGOLIA_INDEX_NAME,
1920
placeholderImage: process.env.PUBLIC_PLACEHOLDER_SMALL_IMAGE_URL,
2021
},
2122
},

pages/search.vue

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,9 @@ import {
4242
AisHits,
4343
} from "vue-instantsearch/vue3/es/index.js";
4444
45-
const indexName = "dfweb";
45+
const config = useRuntimeConfig();
46+
47+
const indexName = config.indexName;
4648
const algolia = useAlgoliaRef();
4749
4850
const convertProductNameToSlug = (productName) =>

0 commit comments

Comments
 (0)