feat: shared request (#3486)
Co-authored-by: jamesgeorge007 <jamesgeorge998001@gmail.com>
This commit is contained in:
7
packages/hoppscotch-common/src/pages/e/_id.vue
Normal file
7
packages/hoppscotch-common/src/pages/e/_id.vue
Normal file
@@ -0,0 +1,7 @@
|
||||
<template>
|
||||
<div class="flex flex-col items-center justify-between p-8">
|
||||
Temporary page for Embed till the feature is ready
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts"></script>
|
||||
@@ -22,14 +22,16 @@
|
||||
</div>
|
||||
<div v-else class="flex flex-1 flex-col items-center justify-center p-4">
|
||||
<div
|
||||
v-if="shortcodeDetails.loading"
|
||||
v-if="sharedRequestDetails.loading"
|
||||
class="flex flex-1 flex-col items-center justify-center p-4"
|
||||
>
|
||||
<HoppSmartSpinner />
|
||||
</div>
|
||||
<div v-else>
|
||||
<div
|
||||
v-if="!shortcodeDetails.loading && E.isLeft(shortcodeDetails.data)"
|
||||
v-if="
|
||||
!sharedRequestDetails.loading && E.isLeft(sharedRequestDetails.data)
|
||||
"
|
||||
class="flex flex-col items-center p-4"
|
||||
>
|
||||
<icon-lucide-alert-triangle class="svg-icons mb-2 opacity-75" />
|
||||
@@ -55,7 +57,10 @@
|
||||
</p>
|
||||
</div>
|
||||
<div
|
||||
v-if="!shortcodeDetails.loading && E.isRight(shortcodeDetails.data)"
|
||||
v-if="
|
||||
!sharedRequestDetails.loading &&
|
||||
E.isRight(sharedRequestDetails.data)
|
||||
"
|
||||
class="flex flex-1 flex-col items-center justify-center p-4"
|
||||
>
|
||||
<h1 class="heading">
|
||||
@@ -95,9 +100,9 @@ const t = useI18n()
|
||||
const tabs = useService(RESTTabService)
|
||||
|
||||
const invalidLink = ref(false)
|
||||
const shortcodeID = ref("")
|
||||
const sharedRequestID = ref("")
|
||||
|
||||
const shortcodeDetails = useGQLQuery<
|
||||
const sharedRequestDetails = useGQLQuery<
|
||||
ResolveShortcodeQuery,
|
||||
ResolveShortcodeQueryVariables,
|
||||
""
|
||||
@@ -109,14 +114,14 @@ const shortcodeDetails = useGQLQuery<
|
||||
})
|
||||
|
||||
watch(
|
||||
() => shortcodeDetails.data,
|
||||
() => sharedRequestDetails.data,
|
||||
() => addRequestToTab()
|
||||
)
|
||||
|
||||
const addRequestToTab = () => {
|
||||
if (shortcodeDetails.loading) return
|
||||
if (sharedRequestDetails.loading) return
|
||||
|
||||
const data = shortcodeDetails.data
|
||||
const data = sharedRequestDetails.data
|
||||
|
||||
if (E.isRight(data)) {
|
||||
if (!data.right.shortcode?.request) {
|
||||
@@ -145,9 +150,9 @@ const reloadApplication = () => {
|
||||
|
||||
onMounted(() => {
|
||||
if (typeof route.params.id === "string") {
|
||||
shortcodeID.value = route.params.id
|
||||
shortcodeDetails.execute()
|
||||
sharedRequestID.value = route.params.id
|
||||
sharedRequestDetails.execute()
|
||||
}
|
||||
invalidLink.value = !shortcodeID.value
|
||||
invalidLink.value = !sharedRequestID.value
|
||||
})
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user