Skip to content
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 apps/dashboard/src/@/api/team.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ export async function getDefaultTeam() {
return null;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[Re: line +70]

separately we just also need to remove this anywhere it is being used

See this comment inline on Graphite.

}

export async function getLastVisitedTeamOrDefaultTeam() {
export async function getLastVisitedTeam() {
const token = await getAuthToken();
if (!token) {
return null;
Expand All @@ -100,5 +100,5 @@ export async function getLastVisitedTeamOrDefaultTeam() {
}
}

return getDefaultTeam();
return null;
}
11 changes: 4 additions & 7 deletions apps/dashboard/src/app/(app)/team/page.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
import { getLastVisitedTeamOrDefaultTeam } from "@/api/team";
import { notFound, redirect } from "next/navigation";
import { getLastVisitedTeam } from "@/api/team";
import { redirect } from "next/navigation";

export default async function TeamRootPage() {
const team = await getLastVisitedTeamOrDefaultTeam();
if (!team) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Previously this would redirect to the notFound page if the token was invalid. Now it redirects to /team/~ to handle it there.
Basically I think /team should always redirect to another team page, and let those pages handle the logged out or invalid auth cases.

notFound();
}
redirect(`/team/${team.slug}`);
const team = await getLastVisitedTeam();
redirect(team ? `/team/${team.slug}` : "/team/~");
}
Loading