mirror of
https://github.com/umami-software/umami.git
synced 2026-02-10 07:37:11 +01:00
Website edit functionality.
This commit is contained in:
parent
30b87bc4c4
commit
00e232fee8
63 changed files with 301 additions and 94 deletions
|
|
@ -1,12 +1,26 @@
|
|||
import { getWebsites } from 'lib/db';
|
||||
import { getWebsites, updateWebsite } from 'lib/db';
|
||||
import { useAuth } from 'lib/middleware';
|
||||
|
||||
export default async (req, res) => {
|
||||
await useAuth(req, res);
|
||||
|
||||
const { user_id } = req.auth;
|
||||
const { website_id } = req.body;
|
||||
|
||||
const websites = await getWebsites(user_id);
|
||||
if (req.method === 'GET') {
|
||||
const websites = await getWebsites(user_id);
|
||||
|
||||
return res.status(200).json({ websites });
|
||||
return res.status(200).json(websites);
|
||||
}
|
||||
|
||||
if (req.method === 'POST') {
|
||||
if (website_id) {
|
||||
const { name, domain } = req.body;
|
||||
const website = await updateWebsite(website_id, { name, domain });
|
||||
|
||||
return res.status(200).json(website);
|
||||
}
|
||||
}
|
||||
|
||||
return res.status(405).end();
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue