summaryrefslogtreecommitdiffhomepage
path: root/packages/console/app/src/routes/auth/index.ts
blob: 2c893185fb41fd03f9f3aa7f57f7c311f369dc18 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
import { Account } from "@opencode/console-core/account.js"
import { redirect } from "@solidjs/router"
import type { APIEvent } from "@solidjs/start/server"
import { withActor } from "~/context/auth.withActor"

export async function GET(input: APIEvent) {
  try {
    const workspaces = await withActor(async () => Account.workspaces())
    return redirect(`/workspace/${workspaces[0].id}`)
  } catch {
    return redirect("/auth/authorize")
  }
}