frontend added and socket io
This commit is contained in:
@@ -96,6 +96,18 @@ r.post("/", async (req, res) => {
|
||||
asResponse: true,
|
||||
});
|
||||
|
||||
if (login.status === 401) {
|
||||
return apiReturn(res, {
|
||||
success: false,
|
||||
level: "error", //connect.success ? "info" : "error",
|
||||
module: "routes",
|
||||
subModule: "auth",
|
||||
message: `Incorrect username or password please try again`,
|
||||
data: [],
|
||||
status: 401, //connect.success ? 200 : 400,
|
||||
});
|
||||
}
|
||||
|
||||
login.headers.forEach((value: string, key: string) => {
|
||||
if (key.toLowerCase() === "set-cookie") {
|
||||
res.append("set-cookie", value);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { APIError } from "better-auth";
|
||||
import { count, sql } from "drizzle-orm";
|
||||
import { count, eq, sql } from "drizzle-orm";
|
||||
import { Router } from "express";
|
||||
import z from "zod";
|
||||
import { db } from "../db/db.controller.js";
|
||||
@@ -58,7 +58,10 @@ r.post("/", async (req, res) => {
|
||||
// if we have no users yet lets make this new one the admin
|
||||
if (userCount === 0) {
|
||||
// make this user an admin
|
||||
await db.update(user).set({ role: "admin", updatedAt: sql`NOW()` });
|
||||
await db
|
||||
.update(user)
|
||||
.set({ role: "admin", updatedAt: sql`NOW()` })
|
||||
.where(eq(user.id, newUser.user.id));
|
||||
}
|
||||
|
||||
apiReturn(res, {
|
||||
|
||||
Reference in New Issue
Block a user