diff --git a/README.md b/README.md index 28380ff..3538fab 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,10 @@ -# Fresh Garden 🍋 +# Fresh Garden 🍋 Authentication plugin for Fresh(Deno) using Lucia. -Fresh Garden is inspired by [devise](https://github.com/heartcombo/devise). -Combining garden with fresh provides the ability to create accounts, log in -and log out. +Fresh Garden is inspired by [devise](https://github.com/heartcombo/devise). +Combining garden with fresh provides the ability to create accounts, log in and +log out. [![Made with Fresh](https://fresh.deno.dev/fresh-badge-dark.svg)](https://fresh.deno.dev) @@ -113,7 +113,7 @@ Please add "(async () => await import('./garden/extra_loader.ts'));" to your mai ``` When using the user resource, set `resourceName: "user"`.\ -At this time, if garden/user/create.tsx(login.tsx, logout.tsx) is available, -it is referenced first. +At this time, if garden/user/create.tsx(login.tsx, logout.tsx) is available, it +is referenced first. Use this for your own customization of CSS or for more detailed customization. diff --git a/routesTemplate/create.tsx b/routesTemplate/create.tsx index d3daeb2..fd5ff09 100644 --- a/routesTemplate/create.tsx +++ b/routesTemplate/create.tsx @@ -1,10 +1,10 @@ import { FreshContext, + GardenInnerParams, LuciaError, PageProps, pascalCase, PASSWORD, - GardenInnerParams, sameLogicValidate, styles, WithCsrf, diff --git a/routesTemplate/login.tsx b/routesTemplate/login.tsx index 4795fa0..59e381d 100644 --- a/routesTemplate/login.tsx +++ b/routesTemplate/login.tsx @@ -1,19 +1,18 @@ import { FreshContext, + GardenInnerParams, Handlers, LuciaError, PageProps, pascalCase, PASSWORD, - GardenInnerParams, stringValidate, styles, WithCsrf, } from "https://deno.land/x/garden/templateDeps.ts"; export function getLoginHandler( - { auth, loginAfterPath, resourceIdentifierName, paths }: - GardenInnerParams, + { auth, loginAfterPath, resourceIdentifierName, paths }: GardenInnerParams, ): Handlers { return { async POST(req: Request, ctx: FreshContext) { diff --git a/routesTemplate/logout.tsx b/routesTemplate/logout.tsx index ab4a84d..592a365 100644 --- a/routesTemplate/logout.tsx +++ b/routesTemplate/logout.tsx @@ -1,7 +1,7 @@ import { FreshContext, - Handlers, GardenInnerParams, + Handlers, WithCsrf, } from "https://deno.land/x/garden/templateDeps.ts"; diff --git a/src/routes/login.tsx b/src/routes/login.tsx index 310b98b..5b448e6 100644 --- a/src/routes/login.tsx +++ b/src/routes/login.tsx @@ -13,8 +13,7 @@ import { GardenInnerParams } from "../../types.ts"; import { PASSWORD } from "../utils/const.ts"; export function getLoginHandler( - { auth, loginAfterPath, resourceIdentifierName, paths }: - GardenInnerParams, + { auth, loginAfterPath, resourceIdentifierName, paths }: GardenInnerParams, ): Handlers { return { async POST(req: Request, ctx: FreshContext) { diff --git a/src/utils/params.ts b/src/utils/params.ts index edc0d74..d452c45 100644 --- a/src/utils/params.ts +++ b/src/utils/params.ts @@ -4,8 +4,7 @@ import { getPathMatchByPathsAndRegExps } from "./pathMatch.ts"; export function getInnerParams( gardenParams: GardenParams, ): GardenInnerParams { - const { resourceName, allowNoSessionPaths, ...innerParams } = - gardenParams; + const { resourceName, allowNoSessionPaths, ...innerParams } = gardenParams; const createPath = `/${resourceName}/create`; const loginPath = `/${resourceName}/login`; const logoutPath = `/${resourceName}/logout`; diff --git a/types.ts b/types.ts index 6f161c4..fcd8bed 100644 --- a/types.ts +++ b/types.ts @@ -76,8 +76,7 @@ export interface DefaultActions { type IdName = `${T}Id`; type LuciaObjectKey = `auth${Capitalize}Session`; -export interface WithGarden - extends Record { +export interface WithGarden extends Record { garden: { [K in LuciaObjectKey]: & {