fix: stop storing form data files in local session
This commit is contained in:
@@ -91,7 +91,7 @@
|
||||
:name="`attachment${index}`"
|
||||
type="file"
|
||||
multiple
|
||||
class="p-1 transition cursor-pointer file:transition file:cursor-pointer text-secondaryLight hover:text-secondaryDark file:mr-4 file:py-1 file:px-4 file:rounded file:border-0 file:text-tiny text-tiny file:text-secondary hover:file:text-secondaryDark file:bg-primaryLight hover:file:bg-primaryDark"
|
||||
class="p-1 transition cursor-pointer file:transition file:cursor-pointer text-secondaryLight hover:text-secondaryDark file:mr-2 file:py-1 file:px-4 file:rounded file:border-0 file:text-tiny text-tiny file:text-secondary hover:file:text-secondaryDark file:bg-primaryLight hover:file:bg-primaryDark"
|
||||
@change="setRequestAttachment(index, param, $event)"
|
||||
/>
|
||||
</label>
|
||||
|
||||
@@ -21,19 +21,32 @@
|
||||
/>
|
||||
</span>
|
||||
</template>
|
||||
<SmartItem
|
||||
v-for="codegen in CodegenDefinitions"
|
||||
:key="codegen.name"
|
||||
:label="codegen.caption"
|
||||
:info-icon="codegen.name === codegenType ? 'done' : ''"
|
||||
:active-info-icon="codegen.name === codegenType"
|
||||
@click.native="
|
||||
() => {
|
||||
codegenType = codegen.name
|
||||
options.tippy().hide()
|
||||
}
|
||||
"
|
||||
/>
|
||||
<div class="flex flex-col space-y-2">
|
||||
<div class="sticky top-0">
|
||||
<input
|
||||
v-model="searchQuery"
|
||||
type="search"
|
||||
autocomplete="off"
|
||||
class="flex w-full p-4 py-2 !bg-popover input"
|
||||
:placeholder="`${t('action.search')}`"
|
||||
/>
|
||||
</div>
|
||||
<div class="flex flex-col">
|
||||
<SmartItem
|
||||
v-for="codegen in filteredCodegenDefinitions"
|
||||
:key="codegen.name"
|
||||
:label="codegen.caption"
|
||||
:info-icon="codegen.name === codegenType ? 'done' : ''"
|
||||
:active-info-icon="codegen.name === codegenType"
|
||||
@click.native="
|
||||
() => {
|
||||
codegenType = codegen.name
|
||||
options.tippy().hide()
|
||||
}
|
||||
"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</tippy>
|
||||
<div class="flex justify-between flex-1">
|
||||
<label for="generatedCode" class="p-4">
|
||||
@@ -147,4 +160,12 @@ const copyRequestCode = () => {
|
||||
toast.success(`${t("state.copied_to_clipboard")}`)
|
||||
setTimeout(() => (copyIcon.value = "copy"), 1000)
|
||||
}
|
||||
|
||||
const searchQuery = ref("")
|
||||
|
||||
const filteredCodegenDefinitions = computed(() => {
|
||||
return CodegenDefinitions.filter((obj) =>
|
||||
Object.values(obj).some((val) => val.includes(searchQuery.value))
|
||||
)
|
||||
})
|
||||
</script>
|
||||
|
||||
@@ -13,7 +13,6 @@
|
||||
@apply rounded;
|
||||
@apply pl-2;
|
||||
@apply pr-0.5;
|
||||
@apply bg-transparent;
|
||||
@apply border border-divider;
|
||||
@apply bg-primaryDark;
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -6,6 +6,7 @@ import isEmpty from "lodash/isEmpty"
|
||||
import * as O from "fp-ts/Option"
|
||||
import { pipe } from "fp-ts/function"
|
||||
import { translateToNewRequest } from "@hoppscotch/data"
|
||||
import { cloneDeep } from "lodash"
|
||||
import {
|
||||
settingsStore,
|
||||
bulkApplySettings,
|
||||
@@ -284,7 +285,19 @@ function setupRequestPersistence() {
|
||||
}
|
||||
|
||||
restRequest$.subscribe((req) => {
|
||||
window.localStorage.setItem("restRequest", JSON.stringify(req))
|
||||
const reqClone = cloneDeep(req)
|
||||
if (reqClone.body.contentType === "multipart/form-data") {
|
||||
reqClone.body.body = reqClone.body.body.map((x) => {
|
||||
if (x.isFile)
|
||||
return {
|
||||
...x,
|
||||
isFile: false,
|
||||
value: "",
|
||||
}
|
||||
else return x
|
||||
})
|
||||
}
|
||||
window.localStorage.setItem("restRequest", JSON.stringify(reqClone))
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user