Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: redirect to home page after project created #587

Merged
merged 7 commits into from
Sep 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions e2e_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ Deno.test("[e2e] POST /api/items", async (test) => {
assertEquals(resp2.status, Status.BadRequest);
});

await test.step("creates an item and redirects to the item page", async () => {
await test.step("creates an item and redirects to the home page", async () => {
const item = { title: "Title text", url: "http://bobross.com" };
const body = new FormData();
body.set("title", item.title);
Expand All @@ -314,7 +314,7 @@ Deno.test("[e2e] POST /api/items", async (test) => {
const items = await collectValues(listItemsByUser(user.login));

assertEquals(resp.status, Status.SeeOther);
assertEquals(resp.headers.get("location"), `/items/${items[0].id}`);
assertEquals(resp.headers.get("location"), `/`);
// Deep partial match since the item ID is a ULID generated at runtime
assertObjectMatch(items[0], item);
});
Expand Down
2 changes: 1 addition & 1 deletion routes/api/items/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,6 @@ export const handler: Handlers<undefined, State> = {
score: 0,
};
await createItem(item);
return redirect("/items/" + item.id);
return redirect("/");
},
};