Small naming changes

This commit is contained in:
Jason Casareno
2022-07-21 20:58:53 -07:00
parent 1a629a1219
commit 7006fa57e2
5 changed files with 32 additions and 9 deletions

View File

@@ -19,7 +19,7 @@ jobs:
run_install: true run_install: true
- name: Setup Environment - name: Setup Environment
run: mv packages/hoppscotch-app/.env.example packages/hoppscotch-app/.env run: mv packages/hoppscotch-app/.env packages/hoppscotch-app/.env
- name: Build Site - name: Build Site
run: pnpm run generate run: pnpm run generate

View File

@@ -22,7 +22,7 @@ RUN pnpm i --unsafe-perm=true
ENV HOST 0.0.0.0 ENV HOST 0.0.0.0
EXPOSE 3000 EXPOSE 3000
RUN mv packages/hoppscotch-app/.env.example packages/hoppscotch-app/.env RUN mv packages/hoppscotch-app/.env packages/hoppscotch-app/.env
RUN pnpm run generate RUN pnpm run generate

View File

@@ -92,7 +92,7 @@ const toast = useToast()
const emptyVars: string = "Add a new variable" const emptyVars: string = "Add a new variable"
const idTickerV = ref(0) const idTicker = ref(0)
const deletionToast = ref<{ goAway: (delay: number) => void } | null>(null) const deletionToast = ref<{ goAway: (delay: number) => void } | null>(null)
@@ -101,7 +101,7 @@ const vars = useStream(restVars$, [], setRESTVars) as Ref<HoppRESTVar[]>
// The UI representation of the variables list (has the empty end variable) // The UI representation of the variables list (has the empty end variable)
const workingVars = ref<Array<HoppRESTVar & { id: number }>>([ const workingVars = ref<Array<HoppRESTVar & { id: number }>>([
{ {
id: idTickerV.value++, id: idTicker.value++,
key: "", key: "",
value: "", value: "",
}, },
@@ -111,13 +111,38 @@ const workingVars = ref<Array<HoppRESTVar & { id: number }>>([
watch(workingVars, (varsList) => { watch(workingVars, (varsList) => {
if (varsList.length > 0 && varsList[varsList.length - 1].key !== "") { if (varsList.length > 0 && varsList[varsList.length - 1].key !== "") {
workingVars.value.push({ workingVars.value.push({
id: idTickerV.value++, id: idTicker.value++,
key: "", key: "",
value: "", value: "",
}) })
} }
}) })
// Sync logic between params and working/bulk params
watch(
vars,
(newParamsList) => {
// Sync should overwrite working params
const filteredWorkingVars: HoppRESTVar[] = pipe(
workingVars.value,
A.filterMap(
flow(
O.fromPredicate((e) => e.key !== ""),
O.map(objRemoveKey("id"))
)
)
)
if (!isEqual(newParamsList, filteredWorkingVars)) {
workingVars.value = pipe(
newParamsList,
A.map((x) => ({ id: idTicker.value++, ...x }))
)
}
},
{ immediate: true }
)
watch(workingVars, (newWorkingVars) => { watch(workingVars, (newWorkingVars) => {
const fixedVars = pipe( const fixedVars = pipe(
newWorkingVars, newWorkingVars,
@@ -136,7 +161,7 @@ watch(workingVars, (newWorkingVars) => {
const addVar = () => { const addVar = () => {
workingVars.value.push({ workingVars.value.push({
id: idTickerV.value++, id: idTicker.value++,
key: "", key: "",
value: "", value: "",
}) })

View File

@@ -4,12 +4,12 @@ import {
FormDataKeyValue, FormDataKeyValue,
HoppRESTHeader, HoppRESTHeader,
HoppRESTParam, HoppRESTParam,
HoppRESTVar,
HoppRESTReqBody, HoppRESTReqBody,
HoppRESTRequest, HoppRESTRequest,
RESTReqSchemaVersion, RESTReqSchemaVersion,
HoppRESTAuth, HoppRESTAuth,
ValidContentTypes, ValidContentTypes,
HoppRESTVar,
} from "@hoppscotch/data" } from "@hoppscotch/data"
import DispatchingStore, { defineDispatchers } from "./DispatchingStore" import DispatchingStore, { defineDispatchers } from "./DispatchingStore"
import { HoppRESTResponse } from "~/helpers/types/HoppRESTResponse" import { HoppRESTResponse } from "~/helpers/types/HoppRESTResponse"

View File

@@ -321,8 +321,6 @@ function setupRequestPersistence() {
} }
window.localStorage.setItem("restRequest", JSON.stringify(reqClone)) window.localStorage.setItem("restRequest", JSON.stringify(reqClone))
}) })
console.log("localRequest", localRequest)
} }
export function setupLocalPersistence() { export function setupLocalPersistence() {