-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #154 from upstash/DX-999-feedback-2
Workflow: Context in Failure Function
- Loading branch information
Showing
21 changed files
with
499 additions
and
241 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,34 +4,25 @@ import { useSearchParams } from 'next/navigation'; | |
import { Suspense, useEffect, useState } from 'react'; | ||
|
||
function Home() { | ||
const [baseUrl, setBaseUrl] = useState("http://localhost:3000"); | ||
const [requestBody, setRequestBody] = useState('{"date":123,"email":"[email protected]","amount":10}'); | ||
const [loading, setLoading] = useState(false); | ||
const searchParams = useSearchParams(); | ||
|
||
// Ensure baseUrl doesn't have a trailing slash | ||
useEffect(() => { | ||
if (baseUrl.endsWith('/')) { | ||
setBaseUrl(baseUrl.replace(/\/$/, '')); | ||
} | ||
}, [baseUrl]); | ||
|
||
const search = searchParams.get('function'); | ||
const [route, setRoute] = useState(search ?? "path"); | ||
|
||
const routes = ['path', 'sleep', 'sleepWithoutAwait', 'northStarSimple', 'northStar', 'call']; | ||
|
||
const handleSend = async () => { | ||
setLoading(true); | ||
const url = `${baseUrl}/-call-qstash`; | ||
const url = `/-call-qstash`; | ||
try { | ||
const response = await fetch(url, { | ||
headers: { | ||
'Content-Type': 'application/json' | ||
}, | ||
method: "POST", | ||
body: JSON.stringify({ | ||
baseUrl, | ||
route, | ||
payload: JSON.parse(requestBody) | ||
}) | ||
|
@@ -49,16 +40,6 @@ function Home() { | |
<div className="bg-white p-6 rounded shadow-md w-full max-w-md"> | ||
<h1 className="text-xl font-bold mb-4">Send Request</h1> | ||
|
||
<div className="mb-4"> | ||
<label className="block text-gray-700">Base URL (replace with deployment URL):</label> | ||
<input | ||
type="text" | ||
value={baseUrl} | ||
onChange={(e) => setBaseUrl(e.target.value)} | ||
className="mt-1 block w-full px-3 py-2 bg-white border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm" | ||
/> | ||
</div> | ||
|
||
<div className="mb-4"> | ||
<label className="block text-gray-700">Route:</label> | ||
<select | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,15 +3,6 @@ | |
<div class="bg-white p-6 rounded shadow-md w-full max-w-md"> | ||
<h1 class="text-xl font-bold mb-4">Send Request</h1> | ||
|
||
<div class="mb-4"> | ||
<label class="block text-gray-700">Base URL deployment URL:</label> | ||
<input | ||
v-model="baseUrl" | ||
type="text" | ||
class="mt-1 block w-full px-3 py-2 bg-white border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm" | ||
/> | ||
</div> | ||
|
||
<div class="mb-4"> | ||
<label class="block text-gray-700">Route:</label> | ||
<select | ||
|
@@ -48,32 +39,23 @@ | |
<script setup> | ||
import { ref } from 'vue'; | ||
const baseUrl = ref('http://localhost:3000'); | ||
const requestBody = ref('{"date":123,"email":"[email protected]","amount":10}'); | ||
const loading = ref(false); | ||
const route = ref('path'); | ||
const routes = ['path', 'sleep', 'sleepWithoutAwait', 'northStarSimple', 'northStar']; | ||
// Ensure baseUrl doesn't have a trailing slash | ||
watch(baseUrl, (newVal) => { | ||
if (newVal.endsWith('/')) { | ||
baseUrl.value = newVal.replace(/\/$/, ''); | ||
} | ||
}); | ||
const handleSend = async () => { | ||
loading.value = true; | ||
const url = `${baseUrl.value}/api/callQstash`; | ||
const url = "/api/callQstash"; | ||
try { | ||
const response = await fetch(url, { | ||
headers: { | ||
'Content-Type': 'application/json' | ||
}, | ||
method: "POST", | ||
body: JSON.stringify({ | ||
baseUrl: baseUrl.value, | ||
route: route.value, | ||
payload: requestBody.value | ||
payload: JSON.parse(requestBody.value) | ||
}) | ||
}); | ||
console.log('Response:', await response.json()); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,24 @@ | ||
import { createSignal, createEffect } from 'solid-js'; | ||
|
||
const LandingPage = () => { | ||
const [baseUrl, setBaseUrl] = createSignal("http://localhost:3000"); | ||
const [requestBody, setRequestBody] = createSignal('{"date":123,"email":"[email protected]","amount":10}'); | ||
const [route, setRoute] = createSignal("path"); | ||
const [loading, setLoading] = createSignal(false); | ||
|
||
// Ensure baseUrl doesn't have a trailing slash | ||
createEffect(() => { | ||
const url = baseUrl(); | ||
if (url.endsWith('/')) { | ||
setBaseUrl(url.replace(/\/$/, '')); | ||
} | ||
}); | ||
|
||
const routes = ['path', 'sleep', 'sleepWithoutAwait', 'northStarSimple', 'northStar']; | ||
|
||
const handleSend = async () => { | ||
setLoading(true); | ||
const url = `${baseUrl()}/-call-qstash`; | ||
const url = "/-call-qstash"; | ||
try { | ||
const response = await fetch(url, { | ||
headers: { | ||
'Content-Type': 'application/json' | ||
}, | ||
method: "POST", | ||
body: JSON.stringify({ | ||
baseUrl: baseUrl(), | ||
route: route(), | ||
payload: requestBody(), | ||
payload: JSON.parse(requestBody()), | ||
}) | ||
}); | ||
console.log('Response:', await response.json()); | ||
|
@@ -44,16 +34,6 @@ const LandingPage = () => { | |
<div className="bg-white p-6 rounded shadow-md w-full max-w-md"> | ||
<h1 className="text-xl font-bold mb-4">Send Request</h1> | ||
|
||
<div className="mb-4"> | ||
<label className="block text-gray-700">Base URL (replace with deployment URL):</label> | ||
<input | ||
type="text" | ||
value={baseUrl()} | ||
onInput={(e) => setBaseUrl(e.currentTarget.value)} | ||
className="mt-1 block w-full px-3 py-2 bg-white border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm" | ||
/> | ||
</div> | ||
|
||
<div className="mb-4"> | ||
<label className="block text-gray-700">Route:</label> | ||
<select | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,33 +3,24 @@ | |
import { page } from '$app/stores'; | ||
import { writable } from 'svelte/store'; | ||
let baseUrl = writable("http://localhost:3000"); | ||
let requestBody = writable('{"date":123,"email":"[email protected]","amount":10}'); | ||
let loading = writable(false); | ||
let route = writable('path'); | ||
// Ensure baseUrl doesn't have a trailing slash | ||
baseUrl.subscribe(value => { | ||
if (value.endsWith('/')) { | ||
baseUrl.set(value.replace(/\/$/, '')); | ||
} | ||
}); | ||
const routes = ['path', 'sleep', 'sleepWithoutAwait', 'northStarSimple', 'northStar']; | ||
const handleSend = async () => { | ||
loading.set(true); | ||
const url = `${$baseUrl}/-call-qstash`; | ||
const url = "/-call-qstash"; | ||
try { | ||
const response = await fetch(url, { | ||
headers: { | ||
'Content-Type': 'application/json' | ||
}, | ||
method: "POST", | ||
body: JSON.stringify({ | ||
baseUrl: $baseUrl, | ||
route: $route, | ||
payload: $requestBody | ||
payload: JSON.parse($requestBody) | ||
}) | ||
}); | ||
console.log('Response:', await response.json()); | ||
|
@@ -45,15 +36,6 @@ | |
<div class="bg-white p-6 rounded shadow-md w-full max-w-md"> | ||
<h1 class="text-xl font-bold mb-4">Send Request</h1> | ||
|
||
<div class="mb-4"> | ||
<label class="block text-gray-700">Base URL (replace with deployment URL):</label> | ||
<input | ||
type="text" | ||
bind:value={$baseUrl} | ||
class="mt-1 block w-full px-3 py-2 bg-white border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm" | ||
/> | ||
</div> | ||
|
||
<div class="mb-4"> | ||
<label class="block text-gray-700">Route:</label> | ||
<select | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.