Skip to content

Commit

Permalink
update examples to oak 13
Browse files Browse the repository at this point in the history
  • Loading branch information
jcs224 committed Nov 2, 2024
1 parent 72bd0b6 commit 8c11efe
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Supports flash messages - session data that is deleted after it's read.
## Usage

```ts
import { Application, Router } from "jsr:@oak/oak@^12";
import { Application, Router } from "jsr:@oak/oak@^13";
import { Session } from "https://deno.land/x/oak_sessions/mod.ts";

type AppState = {
Expand All @@ -29,7 +29,7 @@ const router = new Router<AppState>();
app.use(Session.initMiddleware())

router.post('/login', async (ctx) => {
const form = await ctx.request.body({type: 'form'}).value
const form = await ctx.request.body.form()
if(form.get('password') === 'correct') {
// Set persistent data in the session
ctx.state.session.set('email', form.get('email'))
Expand Down
4 changes: 2 additions & 2 deletions test/server.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Application, Router } from "jsr:@oak/oak@^12"
import { Application, Router } from "jsr:@oak/oak@^13"
import { Session } from '../mod.ts'
import { makeStore } from "./makeStore.ts";

Expand All @@ -25,7 +25,7 @@ app.use(Session.initMiddleware(store, {
}))

router.post('/login', async (ctx) => {
const form = await ctx.request.body({type: 'form'}).value
const form = await ctx.request.body.form()
if(form.get('password') === 'correct') {
// Set persistent data in the session
ctx.state.session.set('email', form.get('email'))
Expand Down

0 comments on commit 8c11efe

Please sign in to comment.