Skip to content

Commit 73c4dac

Browse files
WangZhechaondom91
andauthored
chore(docs): update upstash-redis import code example (#10706)
Co-authored-by: Nico Domino <[email protected]>
1 parent 7a2c48c commit 73c4dac

File tree

1 file changed

+15
-15
lines changed

1 file changed

+15
-15
lines changed

docs/pages/getting-started/adapters/upstash-redis.mdx

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,12 @@ UPSTASH_REDIS_TOKEN
3636
```ts filename="./auth.ts"
3737
import NextAuth from "next-auth"
3838
import { UpstashRedisAdapter } from "@auth/upstash-redis-adapter"
39-
import upstashRedisClient from "@upstash/redis"
39+
import { Redis } from "@upstash/redis"
4040

41-
const redis = upstashRedisClient(
42-
process.env.UPSTASH_REDIS_URL,
43-
process.env.UPSTASH_REDIS_TOKEN
44-
)
41+
const redis = new Redis({
42+
url: process.env.UPSTASH_REDIS_URL!,
43+
token: process.env.UPSTASH_REDIS_TOKEN!,
44+
})
4545

4646
export const { handlers, auth, signIn, signOut } = NextAuth({
4747
adapter: UpstashRedisAdapter(redis),
@@ -55,12 +55,12 @@ export const { handlers, auth, signIn, signOut } = NextAuth({
5555
```ts filename="./src/auth.ts"
5656
import { SvelteKitAuth } from "@auth/sveltekit"
5757
import { UpstashRedisAdapter } from "@auth/upstash-redis-adapter"
58-
import upstashRedisClient from "@upstash/redis"
58+
import { Redis } from "@upstash/redis"
5959

60-
const redis = upstashRedisClient(
61-
process.env.UPSTASH_REDIS_URL,
62-
process.env.UPSTASH_REDIS_TOKEN
63-
)
60+
const redis = new Redis({
61+
url: process.env.UPSTASH_REDIS_URL!,
62+
token: process.env.UPSTASH_REDIS_TOKEN!,
63+
})
6464

6565
export const { handle, signIn, signOut } = SvelteKitAuth({
6666
adapter: UpstashRedisAdapter(redis),
@@ -74,12 +74,12 @@ export const { handle, signIn, signOut } = SvelteKitAuth({
7474
```ts filename="./src/routes/auth.route.ts"
7575
import { ExpressAuth } from "@auth/express"
7676
import { UpstashRedisAdapter } from "@auth/upstash-redis-adapter"
77-
import upstashRedisClient from "@upstash/redis"
77+
import { Redis } from "@upstash/redis"
7878

79-
const redis = upstashRedisClient(
80-
process.env.UPSTASH_REDIS_URL,
81-
process.env.UPSTASH_REDIS_TOKEN
82-
)
79+
const redis = new Redis({
80+
url: process.env.UPSTASH_REDIS_URL!,
81+
token: process.env.UPSTASH_REDIS_TOKEN!,
82+
})
8383

8484
const app = express()
8585

0 commit comments

Comments
 (0)