Skip to content

Commit

Permalink
chore(docs): fix login.md (#1958)
Browse files Browse the repository at this point in the history
  • Loading branch information
mlhiter authored May 28, 2024
1 parent 470661f commit f4f496b
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions docs/zh/quick-start/login.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@
import cloud from "@lafjs/cloud";
import { createHash } from "crypto";

const db = cloud.mongo.db

export default async function (ctx: FunctionContext) {
const username = ctx.body?.username || "";
const password = ctx.body?.password || "";
Expand All @@ -38,7 +40,6 @@ export default async function (ctx: FunctionContext) {
return { error: "invalid password" };

// check username existed
const db = cloud.database();
const exists = await db
.collection("users")
.where({ username: username })
Expand Down Expand Up @@ -68,12 +69,13 @@ export default async function (ctx: FunctionContext) {
import cloud from "@lafjs/cloud";
import { createHash } from "crypto";

const db = cloud.mongo.db

export default async function (ctx: FunctionContext) {
const username = ctx.body?.username || "";
const password = ctx.body?.password || "";

// check user login
const db = cloud.database();
const res = await db
.collection("users")
.where({
Expand Down

0 comments on commit f4f496b

Please sign in to comment.