feat: add getAllUsers function and integrate user fetching in dashboard
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import mysql from "mysql2";
|
||||
import dotenv from "dotenv";
|
||||
import { error } from "console";
|
||||
dotenv.config();
|
||||
|
||||
// Create a MySQL connection pool using environment variables for configuration
|
||||
@@ -130,3 +131,12 @@ export async function deleteUser(
|
||||
}
|
||||
} catch (err) {}
|
||||
}
|
||||
|
||||
export async function getAllUsers() {
|
||||
try {
|
||||
const [data] = await pool.query("SELECT * FROM users;");
|
||||
return { result: data, success: true };
|
||||
} catch (err) {
|
||||
return { result: err, success: false };
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user