wip: implement add bookmark
This commit is contained in:
@@ -90,7 +90,7 @@ async function signUp(request: Bun.BunRequest<"/api/sign-up">) {
|
||||
|
||||
const signUpRequest = SignUpRequest(body)
|
||||
if (signUpRequest instanceof type.errors) {
|
||||
throw new HttpError(400, signUpRequest.summary)
|
||||
throw new HttpError(400, "BadRequestBody", signUpRequest.summary)
|
||||
}
|
||||
|
||||
const { username, password } = signUpRequest
|
||||
@@ -110,7 +110,7 @@ async function login(request: Bun.BunRequest<"/api/login">) {
|
||||
|
||||
const loginRequest = LoginRequest(body)
|
||||
if (loginRequest instanceof type.errors) {
|
||||
throw new HttpError(400, loginRequest.summary)
|
||||
throw new HttpError(400, "BadRequestBody")
|
||||
}
|
||||
|
||||
const foundUser = findUserByUsername(loginRequest.username, {
|
||||
@@ -145,7 +145,7 @@ async function logout(request: Bun.BunRequest<"/api/logout">, user: User): Promi
|
||||
|
||||
forgetAllSessions(user)
|
||||
deleteAllAuthTokensQuery.run({ userId: user.id })
|
||||
return new Response(undefined, { status: 200 })
|
||||
return new Response(undefined, { status: 204 })
|
||||
}
|
||||
|
||||
export { authenticated, signUp, login, logout }
|
||||
|
Reference in New Issue
Block a user