Skip to content

Commit

Permalink
Merge pull request #15 from ymaheshwari1/fix/unused-code
Browse files Browse the repository at this point in the history
Removed: unused code and improved code formatting
  • Loading branch information
ymaheshwari1 authored Jan 11, 2024
2 parents d9e34d2 + fd71bdc commit d4e0a68
Show file tree
Hide file tree
Showing 37 changed files with 239 additions and 372 deletions.
12 changes: 6 additions & 6 deletions src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
</template>

<script setup lang="ts">
import { onMounted, onUnmounted, ref } from 'vue';
import { IonApp, IonRouterOutlet, loadingController } from '@ionic/vue';
import { onMounted, onUnmounted, ref } from "vue";
import { IonApp, IonRouterOutlet, loadingController } from "@ionic/vue";
import emitter from "@/event-bus"
const loader = ref(null) as any
Expand Down Expand Up @@ -37,12 +37,12 @@ onMounted(async () => {
translucent: true,
backdropDismiss: true
});
emitter.on('presentLoader', presentLoader);
emitter.on('dismissLoader', dismissLoader);
emitter.on("presentLoader", presentLoader);
emitter.on("dismissLoader", dismissLoader);
})
onUnmounted(() => {
emitter.off('presentLoader', presentLoader);
emitter.off('dismissLoader', dismissLoader);
emitter.off("presentLoader", presentLoader);
emitter.off("dismissLoader", dismissLoader);
})
</script>
26 changes: 13 additions & 13 deletions src/api/index.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
import axios from 'axios';
import { setupCache } from 'axios-cache-adapter'
import OfflineHelper from '@/offline-helper'
import axios from "axios";
import { setupCache } from "axios-cache-adapter"
import OfflineHelper from "@/offline-helper"
import emitter from "@/event-bus"
import store from '@/store';
import { StatusCodes } from 'http-status-codes';
import router from '@/router'
import store from "@/store";
import { StatusCodes } from "http-status-codes";
import router from "@/router"

axios.interceptors.request.use((config: any) => {
const token = store.getters['user/getUserToken'];
const token = store.getters["user/getUserToken"];
if (token) {
config.headers.Authorization = 'Bearer ' + token;
config.headers['Content-Type'] = 'application/json';
config.headers.Authorization = "Bearer " + token;
config.headers["Content-Type"] = "application/json";
}
return config;
});
Expand All @@ -30,7 +30,7 @@ axios.interceptors.response.use(function (response) {
const { status } = error.response;
if (status === StatusCodes.UNAUTHORIZED) {
store.dispatch("user/logout");
router.push('/login')
router.push("/login")
}
}
// Any status codes that falls outside the range of 2xx cause this function to trigger
Expand All @@ -48,8 +48,8 @@ const axiosCache = setupCache({
* Generic method to call APIs
*
* @param {string} url - API Url
* @param {string=} method - 'GET', 'PUT', 'POST', 'DELETE , and 'PATCH'
* @param {any} [data] - Optional: `data` is the data to be sent as the request body. Only applicable for request methods 'PUT', 'POST', 'DELETE , and 'PATCH'
* @param {string=} method - "GET", "PUT", "POST", "DELETE , and "PATCH"
* @param {any} [data] - Optional: `data` is the data to be sent as the request body. Only applicable for request methods "PUT", "POST", "DELETE , and "PATCH"
* When no `transformRequest` is set, must be of one of the following types:
* - string, plain object, ArrayBuffer, ArrayBufferView, URLSearchParams
* - Browser only: FormData, File, Blob
Expand All @@ -68,7 +68,7 @@ const api = async (customConfig: any) => {
params: customConfig.params
}

const baseURL = store.getters['user/getInstanceUrl'];
const baseURL = store.getters["user/getInstanceUrl"];
if (baseURL) config.baseURL = `https://${baseURL}.hotwax.io/api/`;
if(customConfig.cache) config.adapter = axiosCache.adapter;
const networkStatus = await OfflineHelper.getNetworkStatus();
Expand Down
6 changes: 3 additions & 3 deletions src/components/AddActionModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@ import {
IonTitle,
IonToolbar,
modalController,
} from '@ionic/vue';
import { defineComponent } from 'vue';
import { closeOutline } from 'ionicons/icons';
} from "@ionic/vue";
import { defineComponent } from "vue";
import { closeOutline } from "ionicons/icons";
import { useStore } from "@/store";
export default defineComponent({
Expand Down
10 changes: 5 additions & 5 deletions src/components/Image.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { IonSkeletonText } from '@ionic/vue'
export default defineComponent({
name: "Image",
props: ['src'],
props: ["src"],
components: {
IonSkeletonText
},
Expand All @@ -26,8 +26,8 @@ export default defineComponent({
},
data() {
return {
resourceUrl: '',
imageUrl: ''
resourceUrl: "",
imageUrl: ""
}
},
methods: {
Expand All @@ -45,10 +45,10 @@ export default defineComponent({
},
setImageUrl() {
if (this.src) {
if (this.src.indexOf('assets/') != -1) {
if (this.src.indexOf("assets/") != -1) {
// Assign directly in case of assets
this.imageUrl = this.src;
} else if (this.src.startsWith('http')) {
} else if (this.src.startsWith("http")) {
// If starts with http, it is web url check for existence and assign
this.checkIfImageExists(this.src).then(() => {
this.imageUrl = this.src;
Expand Down
2 changes: 1 addition & 1 deletion src/components/Logo.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
</template>

<script lang="ts">
import { defineComponent } from 'vue'
import { defineComponent } from "vue"
export default defineComponent({
name: "Logo",
Expand Down
38 changes: 19 additions & 19 deletions src/components/RouteMenu.vue
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@
<ion-card v-for="card in [1, 2, 3, 4]" ref="cards" :key="card" @click.prevent="router.push('query')">
<ion-item lines="full">
<ion-label>
<h1>{{ 'Order lookup name' }}</h1>
<h1>{{ "Order lookup name" }}</h1>
</ion-label>
<ion-chip>{{ `${card}/4` }}</ion-chip>
</ion-item>
<ion-item ref="item">
<ion-badge>{{ 'BADGE' }}</ion-badge>
<ion-badge>{{ "BADGE" }}</ion-badge>
<ion-button fill="clear" color="medium" slot="end">
{{ 'Archive' }}
{{ "Archive" }}
</ion-button>
</ion-item>
</ion-card>
Expand All @@ -33,54 +33,54 @@
<ion-list v-show="!isOnBrokeringRulePage">
<ion-item-group>
<ion-item-divider color="medium">
<ion-label>{{ 'Filters' }}</ion-label>
<ion-label>{{ "Filters" }}</ion-label>
</ion-item-divider>
<ion-item>
<ion-select label="Queue" value="Brokering Queue">
<ion-select-option value="Brokering Queue">{{ 'Brokering Queue' }}</ion-select-option>
<ion-select-option value="Brokering Queue">{{ "Brokering Queue" }}</ion-select-option>
</ion-select>
</ion-item>
<ion-item>
<ion-select label="Shipping method" value="Next Day">
<ion-select-option value="Next Day">{{ 'Next Day' }}</ion-select-option>
<ion-select-option value="Next Day">{{ "Next Day" }}</ion-select-option>
</ion-select>
</ion-item>
<ion-item>
<ion-select label="Order priority" value="High">
<ion-select-option value="High">{{ 'High' }}</ion-select-option>
<ion-select-option value="High">{{ "High" }}</ion-select-option>
</ion-select>
</ion-item>
<ion-item>
<ion-label>{{ 'Promise date' }}</ion-label>
<ion-chip>{{ 'select date' }}</ion-chip>
<ion-label>{{ "Promise date" }}</ion-label>
<ion-chip>{{ "select date" }}</ion-chip>
</ion-item>
<ion-item>
<ion-select label="Queue" value="Brokering Queue">
<ion-select-option value="Brokering Queue">{{ 'Brokering Queue' }}</ion-select-option>
<ion-select-option value="Brokering Queue">{{ "Brokering Queue" }}</ion-select-option>
</ion-select>
</ion-item>
</ion-item-group>
</ion-list>
<ion-list v-show="!isOnBrokeringRulePage">
<ion-item-group>
<ion-item-divider color="medium">
<ion-label>{{ 'Sort' }}</ion-label>
<ion-label>{{ "Sort" }}</ion-label>
</ion-item-divider>
<ion-reorder-group :disabled="false">
<ion-item>
<ion-label>{{ 'Ship by' }}</ion-label>
<ion-label>{{ "Ship by" }}</ion-label>
<ion-reorder />
</ion-item>
<ion-item>
<ion-label>{{ 'Ship after' }}</ion-label>
<ion-label>{{ "Ship after" }}</ion-label>
<ion-reorder />
</ion-item>
<ion-item>
<ion-label>{{ 'Order date' }}</ion-label>
<ion-label>{{ "Order date" }}</ion-label>
<ion-reorder />
</ion-item>
<ion-item>
<ion-label>{{ 'Shipping method' }}</ion-label>
<ion-label>{{ "Shipping method" }}</ion-label>
<ion-reorder />
</ion-item>
</ion-reorder-group>
Expand All @@ -106,15 +106,15 @@
</template>

<script setup lang="ts">
import { IonBadge, IonButtons, IonButton, IonCard, IonChip, IonContent, IonFooter, IonIcon, IonItem, IonItemDivider, IonItemGroup, IonLabel, IonList, IonListHeader, IonMenu, IonReorder, IonReorderGroup, IonSelect, IonSelectOption, IonToolbar, createAnimation } from '@ionic/vue';
import { IonBadge, IonButtons, IonButton, IonCard, IonChip, IonContent, IonFooter, IonIcon, IonItem, IonItemDivider, IonItemGroup, IonLabel, IonList, IonListHeader, IonMenu, IonReorder, IonReorderGroup, IonSelect, IonSelectOption, IonToolbar, createAnimation } from "@ionic/vue";
import { addCircleOutline, archiveOutline, chevronUpOutline } from "ionicons/icons";
import { computed, ref } from 'vue';
import { useRouter } from 'vue-router';
import { computed, ref } from "vue";
import { useRouter } from "vue-router";
const router = useRouter();
const cards = ref([])
const listHeader = ref(null) as any
const item = ref(null) as any
const isOnBrokeringRulePage = computed(() => router.currentRoute.value.fullPath.includes('/route'))
const isOnBrokeringRulePage = computed(() => router.currentRoute.value.fullPath.includes("/route"))
</script>
14 changes: 7 additions & 7 deletions src/components/RuleConfiguration.vue
Original file line number Diff line number Diff line change
Expand Up @@ -70,16 +70,16 @@
</template>

<script lang="ts">
import { IonAccordionGroup, IonAccordion, IonButton, IonCard, IonCardHeader, IonCardTitle, IonContent, IonDatetime, IonItem, IonInput, IonLabel, IonSelect, IonSelectOption, IonIcon, IonModal, popoverController, modalController } from '@ionic/vue';
import { IonAccordionGroup, IonAccordion, IonButton, IonCard, IonCardHeader, IonCardTitle, IonContent, IonDatetime, IonItem, IonInput, IonLabel, IonSelect, IonSelectOption, IonIcon, IonModal, popoverController, modalController } from "@ionic/vue";
import { addOutline, ellipsisVerticalOutline } from "ionicons/icons";
import { defineComponent } from 'vue';
import { useRouter } from 'vue-router';
import { useStore } from 'vuex';
import RulePopover from '@/components/RulePopover.vue'
import AddActionModal from '@/components/AddActionModal.vue'
import { defineComponent } from "vue";
import { useRouter } from "vue-router";
import { useStore } from "vuex";
import RulePopover from "@/components/RulePopover.vue"
import AddActionModal from "@/components/AddActionModal.vue"
export default defineComponent({
name: 'Home',
name: "RuleConfiguration",
components: {
IonAccordionGroup,
IonAccordion,
Expand Down
8 changes: 4 additions & 4 deletions src/components/RulePopover.vue
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@
</template>

<script>
import { IonContent, IonIcon, IonLabel, IonItem } from '@ionic/vue';
import { defineComponent } from 'vue';
import { IonContent, IonIcon, IonLabel, IonItem } from "@ionic/vue";
import { defineComponent } from "vue";
import { useStore } from "vuex";
import {
copyOutline,
trashOutline
} from 'ionicons/icons';
} from "ionicons/icons";
export default defineComponent({
name: 'rulePopover',
name: "RulePopover",
components: { IonContent, IonIcon, IonLabel, IonItem },
setup() {
const store = useStore();
Expand Down
2 changes: 1 addition & 1 deletion src/event-bus/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import mitt from 'mitt'
import mitt from "mitt"

const emitter = mitt();

Expand Down
10 changes: 5 additions & 5 deletions src/i18n.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { createI18n, LocaleMessages, VueMessageType } from 'vue-i18n'
import { createI18n, LocaleMessages, VueMessageType } from "vue-i18n"

/**
* Load locale messages
Expand All @@ -7,7 +7,7 @@ import { createI18n, LocaleMessages, VueMessageType } from 'vue-i18n'
* See: https://github.com/intlify/vue-i18n-loader#rocket-i18n-resource-pre-compilation
*/
function loadLocaleMessages(): LocaleMessages<VueMessageType> {
const locales = require.context('./locales', true, /[A-Za-z0-9-_,\s]+\.json$/i)
const locales = require.context("./locales", true, /[A-Za-z0-9-_,\s]+\.json$/i)
const messages: LocaleMessages<VueMessageType> = {}
locales.keys().forEach(key => {
const matched = key.match(/([A-Za-z0-9-_]+)\./i)
Expand All @@ -20,16 +20,16 @@ function loadLocaleMessages(): LocaleMessages<VueMessageType> {
}

const i18n = createI18n({
locale: process.env.VUE_APP_I18N_LOCALE || 'en',
fallbackLocale: process.env.VUE_APP_I18N_FALLBACK_LOCALE || 'en',
locale: process.env.VUE_APP_I18N_LOCALE || "en",
fallbackLocale: process.env.VUE_APP_I18N_FALLBACK_LOCALE || "en",
messages: loadLocaleMessages()
})

// TODO Check if this is needed in updated versions
// Currently this method is added to be used in ts files
const translate = (key: string) => {
if (!key) {
return '';
return "";
}
return i18n.global.t(key);
};
Expand Down
Loading

0 comments on commit d4e0a68

Please sign in to comment.