commiting change with default variables

This commit is contained in:
isaiM6
2022-07-28 17:27:35 -07:00
7 changed files with 31 additions and 8 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

@@ -96,6 +96,7 @@ const idTicker = ref(0)
const deletionToast = ref<{ goAway: (delay: number) => void } | null>(null) const deletionToast = ref<{ goAway: (delay: number) => void } | null>(null)
// The functional variables list (the variables actually applied to the session)
const vars = useStream(restVars$, [], setRESTVars) as Ref<HoppRESTVar[]> 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)
@@ -153,7 +154,6 @@ watch(workingVars, (newWorkingVars) => {
) )
) )
) )
console.log("vars.value1", vars.value)
if (!isEqual(vars.value, fixedVars)) { if (!isEqual(vars.value, fixedVars)) {
vars.value = cloneDeep(fixedVars) vars.value = cloneDeep(fixedVars)
} }

View File

@@ -212,6 +212,7 @@ onMounted(() => {
if (editor.value) { if (editor.value) {
if (!view.value) initView(editor.value) if (!view.value) initView(editor.value)
} }
console.log("editor.value", editor.value)
}) })
watch(editor, () => { watch(editor, () => {

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"
@@ -30,7 +30,12 @@ export const getDefaultRESTRequest = (): HoppRESTRequest => ({
endpoint: "https://echo.hoppscotch.io", endpoint: "https://echo.hoppscotch.io",
name: "Untitled request", name: "Untitled request",
params: [], params: [],
vars: [], vars: [
{
key: "amount",
value: "23",
},
],
headers: [], headers: [],
method: "GET", method: "GET",
auth: { auth: {
@@ -148,6 +153,16 @@ const dispatchers = defineDispatchers({
}, },
} }
}, },
deleteVar(curr: RESTSession, { index }: { index: number }) {
const newVars = curr.request.vars.filter((_x, i) => i !== index)
return {
request: {
...curr.request,
vars: newVars,
},
}
},
deleteAllParams(curr: RESTSession) { deleteAllParams(curr: RESTSession) {
return { return {
request: { request: {
@@ -461,6 +476,15 @@ export function deleteRESTParam(index: number) {
}) })
} }
export function deleteRESTVar(index: number) {
restSessionStore.dispatch({
dispatcher: "deleteVar",
payload: {
index,
},
})
}
export function deleteAllRESTParams() { export function deleteAllRESTParams() {
restSessionStore.dispatch({ restSessionStore.dispatch({
dispatcher: "deleteAllParams", dispatcher: "deleteAllParams",

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() {

View File

@@ -8,7 +8,7 @@ import { lodashIsEqualEq, mapThenEq, undefinedEq } from "../utils/eq"
export * from "./content-types" export * from "./content-types"
export * from "./HoppRESTAuth" export * from "./HoppRESTAuth"
export const RESTReqSchemaVersion = "2" export const RESTReqSchemaVersion = "1"
export type HoppRESTParam = { export type HoppRESTParam = {
key: string key: string