-
Notifications
You must be signed in to change notification settings - Fork 878
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
perf(external): hydrate auth providers
Signed-off-by: Innei <tukon479@gmail.com>
- Loading branch information
Showing
6 changed files
with
68 additions
and
17 deletions.
There are no files selected for viewing
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import type { GetHydrateData } from "@client/lib/helper" | ||
import type { AuthProvider } from "@client/query/users" | ||
|
||
import { createApiFetch } from "~/lib/api-client" | ||
import { defineMetadata } from "~/meta-handler" | ||
|
||
const getTypedProviders = async () => { | ||
const apiFetch = createApiFetch() | ||
const data = (await apiFetch("/better-auth/get-providers")) as Record<string, AuthProvider> | ||
|
||
return data | ||
} | ||
|
||
const meta = defineMetadata(async () => { | ||
const providers = await getTypedProviders() | ||
|
||
return [ | ||
{ | ||
type: "title", | ||
title: "Login", | ||
}, | ||
{ | ||
type: "hydrate", | ||
data: providers, | ||
path: "/login", | ||
key: `betterAuth`, | ||
}, | ||
] as const | ||
}) | ||
|
||
export type LoginHydrateData = GetHydrateData<typeof meta> | ||
export default meta |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,12 @@ | ||
// This file is generated by `pnpm run meta` | ||
import i1 from "../client/pages/(main)/share/feeds/[id]/metadata" | ||
import i2 from "../client/pages/(main)/share/lists/[id]/metadata" | ||
import i0 from "../client/pages/(main)/share/users/[id]/metadata" | ||
import i0 from ".././client/pages/(login)/login/metadata" | ||
import i3 from ".././client/pages/(main)/share/feeds/[id]/metadata" | ||
import i2 from ".././client/pages/(main)/share/lists/[id]/metadata" | ||
import i1 from ".././client/pages/(main)/share/users/[id]/metadata" | ||
|
||
export default { | ||
"/share/users/:id": i0, | ||
"/share/feeds/:id": i1, | ||
"/login": i0, | ||
"/share/users/:id": i1, | ||
"/share/lists/:id": i2, | ||
"/share/feeds/:id": i3, | ||
} |