@@ -27232,10 +27232,15 @@ var CodeceptApp = (() => {
2723227232 import_react.default.useEffect(() => {
2723327233 const urlParams = new URLSearchParams(location.search)
2723427234 if (urlParams.has('posted')) {
27235- fetch('/api/post-data.php')
27236- .then(response => response.json())
27237- .then(data => setPostData(data))
27238- .catch(() => setPostData({}))
27235+ try {
27236+ const storedData = localStorage.getItem('codeceptjs_post_data')
27237+ if (storedData) {
27238+ setPostData(JSON.parse(storedData))
27239+ localStorage.removeItem('codeceptjs_post_data')
27240+ }
27241+ } catch (error) {
27242+ setPostData({})
27243+ }
2723927244 } else {
2724027245 setPostData({})
2724127246 }
@@ -27256,7 +27261,7 @@ var CodeceptApp = (() => {
2725627261 /* @__PURE__ */ (0, import_jsx_runtime.jsx)('div', {
2725727262 id: 'area1',
2725827263 'qa-id': 'test',
27259- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx )('a', { href: '/form/file', 'qa-id': 'test', 'qa-link': 'test', children: ' Test Link ' }),
27264+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs )('a', { href: '/form/file', 'qa-id': 'test', 'qa-link': 'test', children: [' ', ' Test Link', ' '] }),
2726027265 }),
2726127266 /* @__PURE__ */ (0, import_jsx_runtime.jsx)('div', {
2726227267 id: 'area2',
@@ -27324,13 +27329,27 @@ var CodeceptApp = (() => {
2732427329 }
2732527330 function FormFilePage() {
2732627331 const postData = usePostData()
27332+ const navigate = useNavigate()
27333+ const handleSubmit = e => {
27334+ e.preventDefault()
27335+ const formData = new FormData(e.target)
27336+ const data = {}
27337+ for (let [key, value] of formData.entries()) {
27338+ if (value instanceof File) {
27339+ data[key] = `${value.name} (${value.size} bytes, ${value.type})`
27340+ } else {
27341+ data[key] = value
27342+ }
27343+ }
27344+ localStorage.setItem('codeceptjs_post_data', JSON.stringify(data))
27345+ navigate('/?posted=1')
27346+ }
2732727347 return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)('div', {
2732827348 children: [
2732927349 /* @__PURE__ */ (0, import_jsx_runtime.jsx)('h1', { children: 'File Upload' }),
2733027350 /* @__PURE__ */ (0, import_jsx_runtime.jsx)('div', { className: 'notice', 'qa-id': 'test' }),
2733127351 /* @__PURE__ */ (0, import_jsx_runtime.jsxs)('form', {
27332- method: 'POST',
27333- action: '/',
27352+ onSubmit: handleSubmit,
2733427353 encType: 'multipart/form-data',
2733527354 children: [
2733627355 /* @__PURE__ */ (0, import_jsx_runtime.jsxs)('p', {
@@ -27366,13 +27385,23 @@ var CodeceptApp = (() => {
2736627385 }
2736727386 function FormHiddenPage() {
2736827387 const postData = usePostData()
27388+ const navigate = useNavigate()
27389+ const handleSubmit = e => {
27390+ e.preventDefault()
27391+ const formData = new FormData(e.target)
27392+ const data = {}
27393+ for (let [key, value] of formData.entries()) {
27394+ data[key] = value
27395+ }
27396+ localStorage.setItem('codeceptjs_post_data', JSON.stringify(data))
27397+ navigate('/?posted=1')
27398+ }
2736927399 return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)('div', {
2737027400 children: [
2737127401 /* @__PURE__ */ (0, import_jsx_runtime.jsx)('h1', { children: 'Hidden Form' }),
2737227402 /* @__PURE__ */ (0, import_jsx_runtime.jsx)('div', { className: 'notice', 'qa-id': 'test' }),
2737327403 /* @__PURE__ */ (0, import_jsx_runtime.jsxs)('form', {
27374- method: 'POST',
27375- action: '/',
27404+ onSubmit: handleSubmit,
2737627405 children: [
2737727406 /* @__PURE__ */ (0, import_jsx_runtime.jsx)('input', { type: 'hidden', name: 'hidden_field', value: 'hidden_value' }),
2737827407 /* @__PURE__ */ (0, import_jsx_runtime.jsxs)('p', {
0 commit comments