diff options
| author | Dax Raad <[email protected]> | 2025-09-02 18:00:48 -0400 |
|---|---|---|
| committer | Dax Raad <[email protected]> | 2025-09-02 18:00:48 -0400 |
| commit | 2e16d685eb5b37e022e7cbd6d4f1ea6cc05f9620 (patch) | |
| tree | e69988fdd16d0b16533f6abca22765af148939c5 /cloud/app/src/routes/auth | |
| parent | e544cccc70cc717d3780bb3ee8a046d8314cc3f2 (diff) | |
| download | opencode-2e16d685eb5b37e022e7cbd6d4f1ea6cc05f9620.tar.gz opencode-2e16d685eb5b37e022e7cbd6d4f1ea6cc05f9620.zip | |
wip: zen
Diffstat (limited to 'cloud/app/src/routes/auth')
| -rw-r--r-- | cloud/app/src/routes/auth/callback.ts | 2 | ||||
| -rw-r--r-- | cloud/app/src/routes/auth/index.ts | 13 | ||||
| -rw-r--r-- | cloud/app/src/routes/auth/logout.ts | 7 |
3 files changed, 14 insertions, 8 deletions
diff --git a/cloud/app/src/routes/auth/callback.ts b/cloud/app/src/routes/auth/callback.ts index 4e38df07e..23025b54d 100644 --- a/cloud/app/src/routes/auth/callback.ts +++ b/cloud/app/src/routes/auth/callback.ts @@ -27,5 +27,5 @@ export async function GET(input: APIEvent) { current: id, } }) - return redirect("/") + return redirect("/auth") } diff --git a/cloud/app/src/routes/auth/index.ts b/cloud/app/src/routes/auth/index.ts new file mode 100644 index 000000000..308ae2d1d --- /dev/null +++ b/cloud/app/src/routes/auth/index.ts @@ -0,0 +1,13 @@ +import { Account } from "@opencode/cloud-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") + } +} diff --git a/cloud/app/src/routes/auth/logout.ts b/cloud/app/src/routes/auth/logout.ts deleted file mode 100644 index 166466ef8..000000000 --- a/cloud/app/src/routes/auth/logout.ts +++ /dev/null @@ -1,7 +0,0 @@ -import type { APIEvent } from "@solidjs/start/server" -import { AuthClient } from "~/context/auth" - -export async function GET(input: APIEvent) { - const result = await AuthClient.authorize(new URL("./callback", input.request.url).toString(), "code") - return Response.redirect(result.url, 302) -} |
