mirror of
https://github.com/umami-software/umami.git
synced 2026-02-11 16:17:13 +01:00
Renamed methods. Initial work on realtime dashboard.
This commit is contained in:
parent
b4ea70a67c
commit
e64a555652
16 changed files with 246 additions and 86 deletions
20
pages/api/realtime.js
Normal file
20
pages/api/realtime.js
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
import { useAuth } from 'lib/middleware';
|
||||
import { ok, unauthorized, methodNotAllowed } from 'lib/response';
|
||||
|
||||
export default async (req, res) => {
|
||||
await useAuth(req, res);
|
||||
|
||||
const { is_admin } = req.auth;
|
||||
|
||||
if (!is_admin) {
|
||||
return unauthorized(res);
|
||||
}
|
||||
|
||||
if (req.method === 'GET') {
|
||||
const [pageviews, sessions, events] = await Promise.all([[], [], []]);
|
||||
|
||||
return ok(res, { pageviews, sessions, events });
|
||||
}
|
||||
|
||||
return methodNotAllowed(res);
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue