commiting change with default variables
This commit is contained in:
@@ -96,6 +96,7 @@ const idTicker = ref(0)
|
||||
|
||||
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[]>
|
||||
|
||||
// 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)) {
|
||||
vars.value = cloneDeep(fixedVars)
|
||||
}
|
||||
|
||||
@@ -212,6 +212,7 @@ onMounted(() => {
|
||||
if (editor.value) {
|
||||
if (!view.value) initView(editor.value)
|
||||
}
|
||||
console.log("editor.value", editor.value)
|
||||
})
|
||||
|
||||
watch(editor, () => {
|
||||
|
||||
@@ -4,12 +4,12 @@ import {
|
||||
FormDataKeyValue,
|
||||
HoppRESTHeader,
|
||||
HoppRESTParam,
|
||||
HoppRESTVar,
|
||||
HoppRESTReqBody,
|
||||
HoppRESTRequest,
|
||||
RESTReqSchemaVersion,
|
||||
HoppRESTAuth,
|
||||
ValidContentTypes,
|
||||
HoppRESTVar,
|
||||
} from "@hoppscotch/data"
|
||||
import DispatchingStore, { defineDispatchers } from "./DispatchingStore"
|
||||
import { HoppRESTResponse } from "~/helpers/types/HoppRESTResponse"
|
||||
@@ -30,7 +30,12 @@ export const getDefaultRESTRequest = (): HoppRESTRequest => ({
|
||||
endpoint: "https://echo.hoppscotch.io",
|
||||
name: "Untitled request",
|
||||
params: [],
|
||||
vars: [],
|
||||
vars: [
|
||||
{
|
||||
key: "amount",
|
||||
value: "23",
|
||||
},
|
||||
],
|
||||
headers: [],
|
||||
method: "GET",
|
||||
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) {
|
||||
return {
|
||||
request: {
|
||||
@@ -461,6 +476,15 @@ export function deleteRESTParam(index: number) {
|
||||
})
|
||||
}
|
||||
|
||||
export function deleteRESTVar(index: number) {
|
||||
restSessionStore.dispatch({
|
||||
dispatcher: "deleteVar",
|
||||
payload: {
|
||||
index,
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
export function deleteAllRESTParams() {
|
||||
restSessionStore.dispatch({
|
||||
dispatcher: "deleteAllParams",
|
||||
|
||||
@@ -321,8 +321,6 @@ function setupRequestPersistence() {
|
||||
}
|
||||
window.localStorage.setItem("restRequest", JSON.stringify(reqClone))
|
||||
})
|
||||
|
||||
console.log("localRequest", localRequest)
|
||||
}
|
||||
|
||||
export function setupLocalPersistence() {
|
||||
|
||||
@@ -8,7 +8,7 @@ import { lodashIsEqualEq, mapThenEq, undefinedEq } from "../utils/eq"
|
||||
export * from "./content-types"
|
||||
export * from "./HoppRESTAuth"
|
||||
|
||||
export const RESTReqSchemaVersion = "2"
|
||||
export const RESTReqSchemaVersion = "1"
|
||||
|
||||
export type HoppRESTParam = {
|
||||
key: string
|
||||
|
||||
Reference in New Issue
Block a user