Open-Source API Development Ecosystem • https://hoppscotch.io • Offline, On-Prem & Cloud • Web, Desktop & CLI • Open-Source Alternative to Postman, Insomnia
TypeScript apiapi-clientapi-restapi-testingdeveloper-toolsgraphqlhttphttp-clientpwarestrest-apispatestingtesting-toolstoolsvuevuejswebsocket
:bug: Fixed #731
Liyas Thomas80d0925ed7b6
diff --git a/functions/fb.js b/functions/fb.jsindex 2a5f8b5d7..77d50bc29 100644--- a/functions/fb.js+++ b/functions/fb.js@@ -21,7 +21,7 @@ const usersCollection = firebase.firestore().collection("users")// the shared state object that any vue component// can get access toexport const fb = {- currentUser: {},+ currentUser: null,currentFeeds: [],currentSettings: [],currentHistory: [],@@ -40,15 +40,15 @@ export const fb = {.doc(fb.currentUser.uid).collection("feeds").add(dt)- .catch(e => console.error("error inserting", dt, e))+ .catch((e) => console.error("error inserting", dt, e))},- deleteFeed: id => {+ deleteFeed: (id) => {usersCollection.doc(fb.currentUser.uid).collection("feeds").doc(id).delete()- .catch(e => console.error("error deleting", id, e))+ .catch((e) => console.error("error deleting", id, e))},writeSettings: async (setting, value) => {const st = {@@ -64,23 +64,23 @@ export const fb = {.collection("settings").doc(setting).set(st)- .catch(e => console.error("error updating", st, e))+ .catch((e) => console.error("error updating", st, e))},- writeHistory: async entry => {+ writeHistory: async (entry) => {const hs = entryusersCollection.doc(fb.currentUser.uid).collection("history").add(hs)- .catch(e => console.error("error inserting", hs, e))+ .catch((e) => console.error("error inserting", hs, e))},- deleteHistory: entry => {+ deleteHistory: (entry) => {usersCollection.doc(fb.currentUser.uid).collection("history").doc(entry.id).delete()- .catch(e => console.error("error deleting", entry, e))+ .catch((e) => console.error("error deleting", entry, e))},clearHistory: () => {usersCollection@@ -88,7 +88,7 @@ export const fb = {.collection("history").get().then(({ docs }) => {- docs.forEach(e => fb.deleteHistory(e))+ docs.forEach((e) => fb.deleteHistory(e))})},toggleStar: (entry, value) => {@@ -97,9 +97,9 @@ export const fb = {.collection("history").doc(entry.id).update({ star: value })- .catch(e => console.error("error deleting", entry, e))+ .catch((e) => console.error("error deleting", entry, e))},- writeCollections: async collection => {+ writeCollections: async (collection) => {const cl = {updatedOn: new Date(),author: fb.currentUser.uid,@@ -112,9 +112,9 @@ export const fb = {.collection("collections").doc("sync").set(cl)- .catch(e => console.error("error updating", cl, e))+ .catch((e) => console.error("error updating", cl, e))},- writeEnvironments: async environment => {+ writeEnvironments: async (environment) => {const ev = {updatedOn: new Date(),author: fb.currentUser.uid,@@ -127,15 +127,15 @@ export const fb = {.collection("environments").doc("sync").set(ev)- .catch(e => console.error("error updating", ev, e))+ .catch((e) => console.error("error updating", ev, e))},}// When a user logs in or out, save that in the store-firebase.auth().onAuthStateChanged(user => {+firebase.auth().onAuthStateChanged((user) => {if (user) {fb.currentUser = user- fb.currentUser.providerData.forEach(profile => {+ fb.currentUser.providerData.forEach((profile) => {let us = {updatedOn: new Date(),provider: profile.providerId,@@ -147,16 +147,16 @@ firebase.auth().onAuthStateChanged(user => {usersCollection.doc(fb.currentUser.uid).set(us)- .catch(e => console.error("error updating", us, e))+ .catch((e) => console.error("error updating", us, e))})usersCollection.doc(fb.currentUser.uid).collection("feeds").orderBy("createdOn", "desc")- .onSnapshot(feedsRef => {+ .onSnapshot((feedsRef) => {const feeds = []- feedsRef.forEach(doc => {+ feedsRef.forEach((doc) => {const feed = doc.data()feed.id = doc.idfeeds.push(feed)@@ -167,9 +167,9 @@ firebase.auth().onAuthStateChanged(user => {usersCollection.doc(fb.currentUser.uid).collection("settings")- .onSnapshot(settingsRef => {+ .onSnapshot((settingsRef) => {const settings = []- settingsRef.forEach(doc => {+ settingsRef.forEach((doc) => {const setting = doc.data()setting.id = doc.idsettings.push(setting)@@ -180,9 +180,9 @@ firebase.auth().onAuthStateChanged(user => {usersCollection.doc(fb.currentUser.uid).collection("history")- .onSnapshot(historyRef => {+ .onSnapshot((historyRef) => {const history = []- historyRef.forEach(doc => {+ historyRef.forEach((doc) => {const entry = doc.data()entry.id = doc.idhistory.push(entry)@@ -193,9 +193,9 @@ firebase.auth().onAuthStateChanged(user => {usersCollection.doc(fb.currentUser.uid).collection("collections")- .onSnapshot(collectionsRef => {+ .onSnapshot((collectionsRef) => {const collections = []- collectionsRef.forEach(doc => {+ collectionsRef.forEach((doc) => {const collection = doc.data()collection.id = doc.idcollections.push(collection)@@ -206,9 +206,9 @@ firebase.auth().onAuthStateChanged(user => {usersCollection.doc(fb.currentUser.uid).collection("environments")- .onSnapshot(environmentsRef => {+ .onSnapshot((environmentsRef) => {const environments = []- environmentsRef.forEach(doc => {+ environmentsRef.forEach((doc) => {const environment = doc.data()environment.id = doc.idenvironments.push(environment)diff --git a/pages/index.vue b/pages/index.vueindex 8ad639e55..a8e110c6c 100644--- a/pages/index.vue+++ b/pages/index.vue@@ -263,13 +263,13 @@</label><input ref="payload" name="payload" type="file" @change="uploadPayload" /><button- class="icon"- @click="prettifyRequestBody()"- v-tooltip="$t('prettify_body')"- v-if="rawInput && this.contentType.endsWith('json')"- >- <i class="material-icons">assistant</i>- </button>+ class="icon"+ @click="prettifyRequestBody()"+ v-tooltip="$t('prettify_body')"+ v-if="rawInput && this.contentType.endsWith('json')"+ >+ <i class="material-icons">assistant</i>+ </button></div></div></li>@@ -858,8 +858,8 @@</li><li><span class="select-wrapper">- <select- :name="'type' + index"+ <select+ :name="'type' + index"@change="$store.commit('setTypeParams', {index,@@ -867,8 +867,12 @@})">- <option value="query" :selected="param.type === 'query'">{{ $t("query") }}</option>- <option value="path" :selected="param.type === 'path'">{{ $t("path") }}</option>+ <option value="query" :selected="param.type === 'query'">{{+ $t("query")+ }}</option>+ <option value="path" :selected="param.type === 'path'">{{+ $t("path")+ }}</option></select></span></li>@@ -1329,7 +1333,11 @@ import { tokenRequest, oauthRedirect } from "../assets/js/oauth"import { sendNetworkRequest } from "../functions/network"import { fb } from "../functions/fb"import { getEditorLangForMimeType } from "~/functions/editorutils"-import { hasPathParams, addPathParamsToVariables, getQueryParams } from "../functions/requestParams.js"+import {+ hasPathParams,+ addPathParamsToVariables,+ getQueryParams,+} from "../functions/requestParams.js"import { parseUrlAndPath } from "../functions/utils/uri.js"const statusCategories = [{@@ -2193,7 +2201,7 @@ export default {}})()} catch (error) {- console.error(error)+ console.log(error)if (error.response) {this.response.headers = error.response.headersthis.response.status = error.response.status@@ -2357,7 +2365,7 @@ export default {url: window.location.href,}).then(() => {})- .catch(console.error)+ .catch(() => {})} else {const dummy = document.createElement("input")document.body.appendChild(dummy)