Comments (4)
Can you show us how you are issuing the redirect and how you are testing it? Because as read this is a description of unexpected behaviour by your browser, not Fresh.
from fresh.
Yes of course. I hope I am not wasting anyone's time by this maybe being a problem with my browser.
So if I hit a page directly by typing the address and the page response is a redirect, everything works fine and maybe I am wrong and this is also expected behavior but if I send a request to the Fresh Server and the response is a redirect, the address bar wont change but the page will load as expected.
So I am trying to use a Form for Login like this
export const handler: Handlers = {
async GET(req: Request, ctx: FreshContext) {
return await ctx.render();
},
async POST(req: Request, ctx: FreshContext) {
const form = await req.formData();
const email = form.get("email")?.toString();
const password = form.get("password")?.toString();
console.log(`Login for ${email} with ${password}`);
const headers = new Headers();
headers.set("location", "/posts");
return new Response(null, {
status: 303,
headers,
});
},
};
export default function Login() {
return (
<>
<Head>
<title>Login</title>
</Head>
<div className="flex flex-wrap w-full max-w-sm bg-emerald-950 rounded-lg mt-24 p-4 mx-auto">
<h1 className="text-4xl font-extrabold mx-auto">Login</h1>
<div className="py-4 w-full">
<form method="POST">
<label
className="block text-red-100 text-base uppercase font-bold mb-1"
htmlFor="email"
>
EMail
</label>
<input
type="email"
id="email"
name="email"
className="w-full border bg-gray-800/50 rounded px-3 py-2 outline-none text-white"
/>
<label
className="block text-red-100 text-base uppercase font-bold mb-1 mt-4"
htmlFor="password"
>
password
</label>
<input
type="password"
id="password"
name="password"
className="w-full border bg-gray-800/50 rounded px-3 py-2 outline-none text-white"
/>
<div class="flex w-full justify-center pt-4">
<button
type="submit"
className="relative bg-emerald-500 border border-transparent hover:border-emerald-200 py-2 px-6 rounded-md font-bold text-lg text-white"
>
Sign In / Login
</button>
</div>
</form>
</div>
</div>
</>
);
}
from fresh.
Thanks for sharing the reproduction code. That made it a lot easier to understand what your scenario is, what happened and what you did expect to happen. Can confirm that this is a bug.
from fresh.
could it also be that in this case of a redirect, fresh also does not load any islands that are related to that page that the redirect is pointing to. Only those island exist, that already have been loaded.
from fresh.
Related Issues (20)
- Hook is already inside component, yet error `Hook can only be invoked from render methods` still occurs HOT 1
- JSX element implicitly has type 'any' because no interface 'JSX.IntrinsicElements' exists. || pragmaFrag cannot be set when runtime is automatic HOT 2
- [Bug] Preact's hydrate will clear uncontrolled property(e.g.`defaultValue) HOT 1
- [bug] partial on form submit HOT 1
- ReadableStream.from not supported if a fresh app is a subfolder HOT 6
- Tailwind plugin wanders into `scss` files then crashes on build HOT 1
- preact has a "We stand with Ukraine" banner, so I won't use it (or fresh or SaasKit)
- What do the <reference /> mean in main.ts? HOT 1
- issues with @headlessui/react HOT 1
- ENV variables in client HOT 5
- Clicking the recipe demo on Fresh's homepage changes the page title to "My Fresh app" HOT 1
- If Fresh /components/ folder doesn't return JS, should I even bother with memo()? HOT 4
- connection error: unexpected end of file HOT 3
- Data passed with `ctx.render` to async route is `undefined` HOT 1
- Docs: Change cart example to not used shared signals
- Build: DNS Error registry-staging.deno.com HOT 1
- fresh.gen.ts is `not found` HOT 5
- n00b struggling with deploying fresh project with deno kv HOT 1
- Island Slots Don't Work With `f-client-nav` HOT 7
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from fresh.