Skip to content

armgit / E2B

Public Imported from GitHub
0

Open-source, secure environment with real-world tools for enterprise-grade agents.

Remove default project from DB seed; Redirect on page for creating new project if no project is found

Tomas Valenta7e60d00b2b6b
diff --git a/pages/index.tsx b/pages/index.tsx
index 0157b7fb2..1bc3ec599 100644
--- a/pages/index.tsx
+++ b/pages/index.tsx
@@ -75,14 +75,25 @@ export const getServerSideProps: GetServerSideProps<Props> = async (ctx) => {
})
return {
- props: {
- projects: team.projects,
- }
+ redirect: {
+ permanent: false,
+ destination: '/new',
+ },
}
}
// Show projects from all teams.
const projects = user.users_teams.flatMap(t => t.teams.projects)
+
+ if (projects.length === 0) {
+ return {
+ redirect: {
+ permanent: false,
+ destination: '/new',
+ },
+ }
+ }
+
return {
props: {
projects,
diff --git a/supabase/seed.sql b/supabase/seed.sql
index d4ca9e4ca..81d49c4d6 100644
--- a/supabase/seed.sql
+++ b/supabase/seed.sql
@@ -16,5 +16,5 @@ INSERT INTO "public"."teams" (id, created_at, name, is_default)
INSERT INTO "public"."users_teams" (user_id, created_at, team_id)
VALUES ('5899f99d-a449-4bfa-8769-19c097aaf1f5', NOW(), '21d2e330-95fa-4b78-b677-47d0713de3da');
-INSERT INTO "public"."projects" (id, created_at, data, team_id, name)
-VALUES ('default_project', NOW(), '{}', '21d2e330-95fa-4b78-b677-47d0713de3da', 'Default Project');
+-- INSERT INTO "public"."projects" (id, created_at, data, team_id, name)
+-- VALUES ('default_project', NOW(), '{}', '21d2e330-95fa-4b78-b677-47d0713de3da', 'Default Project');