2021-07-21 05:20:20 +00:00
|
|
|
<template>
|
|
|
|
|
<AppSection label="preRequest">
|
|
|
|
|
<div
|
|
|
|
|
class="
|
|
|
|
|
bg-primary
|
|
|
|
|
border-b border-dividerLight
|
|
|
|
|
flex flex-1
|
|
|
|
|
pl-4
|
2021-07-26 03:38:06 +00:00
|
|
|
top-24
|
2021-07-21 05:20:20 +00:00
|
|
|
z-10
|
|
|
|
|
sticky
|
|
|
|
|
items-center
|
|
|
|
|
justify-between
|
|
|
|
|
"
|
|
|
|
|
>
|
2021-07-25 20:03:32 +00:00
|
|
|
<label class="font-semibold">
|
2021-07-21 05:20:20 +00:00
|
|
|
{{ $t("javascript_code") }}
|
|
|
|
|
</label>
|
|
|
|
|
<ButtonSecondary
|
|
|
|
|
v-tippy="{ theme: 'tooltip' }"
|
|
|
|
|
to="https://github.com/hoppscotch/hoppscotch/wiki/Pre-Request-Scripts"
|
|
|
|
|
blank
|
|
|
|
|
:title="$t('wiki')"
|
|
|
|
|
icon="help_outline"
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
|
|
|
|
<SmartJsEditor
|
|
|
|
|
v-model="preRequestScript"
|
|
|
|
|
:options="{
|
2021-07-27 12:47:41 +00:00
|
|
|
maxLines: 16,
|
|
|
|
|
minLines: 8,
|
2021-07-25 20:03:32 +00:00
|
|
|
fontSize: '12px',
|
2021-07-21 05:20:20 +00:00
|
|
|
autoScrollEditorIntoView: true,
|
|
|
|
|
showPrintMargin: false,
|
|
|
|
|
useWorker: false,
|
|
|
|
|
}"
|
|
|
|
|
complete-mode="pre"
|
|
|
|
|
/>
|
|
|
|
|
</AppSection>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script lang="ts">
|
|
|
|
|
import { defineComponent } from "@nuxtjs/composition-api"
|
|
|
|
|
import { usePreRequestScript } from "~/newstore/RESTSession"
|
|
|
|
|
|
|
|
|
|
export default defineComponent({
|
|
|
|
|
setup() {
|
|
|
|
|
return {
|
|
|
|
|
preRequestScript: usePreRequestScript(),
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
})
|
|
|
|
|
</script>
|