Skip to content
This repository has been archived by the owner on Sep 22, 2024. It is now read-only.

Commit

Permalink
chore: updates
Browse files Browse the repository at this point in the history
  • Loading branch information
miguelrk committed Jul 2, 2024
1 parent 52555d3 commit 9984d51
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 6 deletions.
2 changes: 1 addition & 1 deletion lib/mod.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { type FreshConfig } from "fresh/server.ts";
import type { FreshConfig } from "fresh/server.ts";
import type { LoaderState } from "netzo/plugins/loader/plugin.ts";
import type { MdxState } from "netzo/plugins/mdx/plugin.ts";
import type { AuthState } from "./plugins/auth/plugin.ts";
Expand Down
4 changes: 2 additions & 2 deletions lib/plugins/auth/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import {
setRequestState,
setSessionState,
} from "./middlewares/mod.ts";
import createAuth from "./routes/auth.tsx";
import createRouteIndex from "./routes/auth.tsx";
import { getRoutesByProvider } from "./routes/mod.ts";
import { EmailAuthConfig } from "./utils/providers/email.ts";
import { NetzoAuthConfig } from "./utils/providers/netzo.ts";
Expand Down Expand Up @@ -150,7 +150,7 @@ export const auth = (config: AuthConfig): Plugin<NetzoState> => {
config.resolveUserData ??= (user) => user?.data ?? {};

const authRoutes: PluginRoute[] = [
{ path: "/auth", component: createAuth(config) },
{ path: "/auth", component: createRouteIndex(config) },
...Object.keys(config.providers)
.filter((provider) => !!config?.providers?.[provider as AuthProvider])
.flatMap((provider) => getRoutesByProvider(provider as AuthProvider, config)),
Expand Down
4 changes: 1 addition & 3 deletions lib/plugins/auth/utils/adapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,7 @@ import type { Auth, AuthUser } from "./types.ts";
export const createDatabaseAuth = (db: ReturnType<typeof database>): Auth => {
const { $users, $sessions } = db?._?.fullSchema! ?? {}; // use fullSchema, not schema
if (!$users) throw new Error(`Missing "$users" table in database schema`);
if (!$sessions) {
throw new Error(`Missing "$sessions" table in database schema`);
}
if (!$sessions) throw new Error(`Missing "$sessions" table in database schema`);

return {
createUser: async (user: AuthUser) => {
Expand Down

0 comments on commit 9984d51

Please sign in to comment.