From fd71bdc6b53b59bc0de6ea63b3be2458aca41ba4 Mon Sep 17 00:00:00 2001 From: Yash Maheshwari Date: Thu, 11 Jan 2024 16:44:04 +0530 Subject: [PATCH] Improved: code formatting --- src/App.vue | 12 +++--- src/api/index.ts | 26 ++++++------ src/components/AddActionModal.vue | 6 +-- src/components/Image.vue | 10 ++--- src/components/Logo.vue | 2 +- src/components/RouteMenu.vue | 38 ++++++++--------- src/components/RuleConfiguration.vue | 14 +++--- src/components/RulePopover.vue | 8 ++-- src/event-bus/index.ts | 2 +- src/i18n.ts | 10 ++--- src/main.ts | 54 ++++++++++++------------ src/offline-helper/index.ts | 10 ++--- src/router/index.ts | 44 +++++++++---------- src/services/UserService.ts | 12 +++--- src/store/actions.ts | 4 +- src/store/getters.ts | 4 +- src/store/index.ts | 24 ++++------- src/store/modules/user/actions.ts | 32 +++++++------- src/store/modules/user/getters.ts | 6 +-- src/store/modules/user/index.ts | 18 ++++---- src/store/modules/user/mutation-types.ts | 12 +++--- src/store/modules/user/mutations.ts | 8 ++-- src/store/mutations.ts | 4 +- src/utils/index.ts | 24 +++++------ src/views/BrokeringQuery.vue | 28 ++++++------ src/views/BrokeringRoute.vue | 18 ++++---- src/views/Login.vue | 12 +++--- src/views/Settings.vue | 32 +++++++------- src/views/TimezoneModal.vue | 12 +++--- 29 files changed, 239 insertions(+), 247 deletions(-) diff --git a/src/App.vue b/src/App.vue index 4a4eb17..10578da 100644 --- a/src/App.vue +++ b/src/App.vue @@ -5,8 +5,8 @@ \ No newline at end of file diff --git a/src/api/index.ts b/src/api/index.ts index e51e71d..ded8246 100644 --- a/src/api/index.ts +++ b/src/api/index.ts @@ -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; }); @@ -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 @@ -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 @@ -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(); diff --git a/src/components/AddActionModal.vue b/src/components/AddActionModal.vue index af4cc0e..f61796e 100644 --- a/src/components/AddActionModal.vue +++ b/src/components/AddActionModal.vue @@ -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({ diff --git a/src/components/Image.vue b/src/components/Image.vue index 9d7c998..5c52bab 100644 --- a/src/components/Image.vue +++ b/src/components/Image.vue @@ -9,7 +9,7 @@ import { IonSkeletonText } from '@ionic/vue' export default defineComponent({ name: "Image", - props: ['src'], + props: ["src"], components: { IonSkeletonText }, @@ -26,8 +26,8 @@ export default defineComponent({ }, data() { return { - resourceUrl: '', - imageUrl: '' + resourceUrl: "", + imageUrl: "" } }, methods: { @@ -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; diff --git a/src/components/Logo.vue b/src/components/Logo.vue index 2a2b29b..a6a2834 100644 --- a/src/components/Logo.vue +++ b/src/components/Logo.vue @@ -6,7 +6,7 @@ diff --git a/src/components/RuleConfiguration.vue b/src/components/RuleConfiguration.vue index 9cf93f1..9b75c55 100644 --- a/src/components/RuleConfiguration.vue +++ b/src/components/RuleConfiguration.vue @@ -70,16 +70,16 @@