Skip to content

Commit 76e6c3a

Browse files
pmondal-intCopilot
authored andcommitted
fix: add missing token checks to request save workflow (hoppscotch#5436)
Co-authored-by: Copilot <[email protected]>
1 parent a3ca9ca commit 76e6c3a

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

packages/hoppscotch-common/src/components/collections/SaveRequest.vue

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,7 @@ import { TeamWorkspace } from "~/services/workspace.service"
154154
import IconSparkle from "~icons/lucide/sparkles"
155155
import IconThumbsDown from "~icons/lucide/thumbs-down"
156156
import IconThumbsUp from "~icons/lucide/thumbs-up"
157+
import { handleTokenValidation } from "~/helpers/handleTokenValidation";
157158
158159
const t = useI18n()
159160
const toast = useToast()
@@ -312,6 +313,9 @@ const onSelect = (pickedVal: Picked | null) => {
312313
}
313314
314315
const saveRequestAs = async () => {
316+
const isValidToken = await handleTokenValidation()
317+
if (!isValidToken) return
318+
315319
if (!requestName.value) {
316320
toast.error(`${t("error.empty_req_name")}`)
317321
return

packages/hoppscotch-common/src/components/http/Request.vue

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -270,6 +270,7 @@ import { RESTTabService } from "~/services/tab/rest"
270270
import { getMethodLabelColor } from "~/helpers/rest/labelColoring"
271271
import { WorkspaceService } from "~/services/workspace.service"
272272
import { KernelInterceptorService } from "~/services/kernel-interceptor.service"
273+
import { handleTokenValidation } from "~/helpers/handleTokenValidation";
273274
274275
const t = useI18n()
275276
const interceptorService = useService(KernelInterceptorService)
@@ -514,7 +515,10 @@ const cycleDownMethod = () => {
514515
}
515516
}
516517
517-
const saveRequest = () => {
518+
const saveRequest = async () => {
519+
const isValidToken = await handleTokenValidation()
520+
if (!isValidToken) return
521+
518522
const saveCtx = tab.value.document.saveContext
519523
520524
if (!saveCtx) {

0 commit comments

Comments
 (0)