fixed chat zustand bug
This commit is contained in:
21
apps/dispatch-server/routes/dispatcher.ts
Normal file
21
apps/dispatch-server/routes/dispatcher.ts
Normal file
@@ -0,0 +1,21 @@
|
||||
import { Router } from "express";
|
||||
import { pubClient } from "modules/redis";
|
||||
|
||||
const router = Router();
|
||||
|
||||
router.get("/", async (req, res) => {
|
||||
const keys = await pubClient.keys("Dispatcher:*");
|
||||
const user = await Promise.all(
|
||||
keys.map(async (key) => {
|
||||
const data = await pubClient.json.get(key);
|
||||
return {
|
||||
...(typeof data === "object" && data !== null ? data : {}),
|
||||
userId: key.split(":")[1],
|
||||
};
|
||||
}),
|
||||
);
|
||||
|
||||
res.json(user);
|
||||
});
|
||||
|
||||
export default router;
|
||||
Reference in New Issue
Block a user