Skip to content

armgit / umami

Public Imported from GitHub
0

Umami is a privacy-first web and product analytics platform. Traffic, campaigns, behavior, conversions, and revenue in one place. No cookies, no surveillance, self-hosted or in the cloud.

Fixed website create.

Mike Cao8a74138e173f
diff --git a/lib/auth.js b/lib/auth.js
index 8ce37bf2b..eb061dcef 100644
--- a/lib/auth.js
+++ b/lib/auth.js
@@ -52,7 +52,7 @@ export async function allowQuery(req, type) {
user: { id: userId },
isAdmin,
shareToken,
- } = req.auth ?? {};
+ } = req.auth;
if (isAdmin) {
return true;
diff --git a/pages/api/realtime/init.js b/pages/api/realtime/init.js
index 1c3265c0f..16e7cad3a 100644
--- a/pages/api/realtime/init.js
+++ b/pages/api/realtime/init.js
@@ -8,7 +8,7 @@ export default async (req, res) => {
await useAuth(req, res);
if (req.method === 'GET') {
- const { userId } = req.auth;
+ const { id: userId } = req.auth.user;
const websites = await getUserWebsites(userId);
const ids = websites.map(({ id }) => id);
diff --git a/pages/api/websites/index.js b/pages/api/websites/index.js
index 8c947a4fd..537d38655 100644
--- a/pages/api/websites/index.js
+++ b/pages/api/websites/index.js
@@ -7,7 +7,10 @@ export default async (req, res) => {
await useCors(req, res);
await useAuth(req, res);
- const { userId, isAdmin } = req.auth;
+ const {
+ user: { id: userId },
+ isAdmin,
+ } = req.auth;
if (req.method === 'GET') {
const { include_all } = req.query;