mirror of
https://github.com/umami-software/umami.git
synced 2026-02-09 15:17:23 +01:00
Pixel editing.
This commit is contained in:
parent
eabdd18604
commit
d130242a0a
23 changed files with 72 additions and 49 deletions
|
|
@ -25,7 +25,6 @@ export async function GET(request: Request, { params }: { params: Promise<{ pixe
|
|||
export async function POST(request: Request, { params }: { params: Promise<{ pixelId: string }> }) {
|
||||
const schema = z.object({
|
||||
name: z.string(),
|
||||
url: z.string().url(),
|
||||
slug: z.string().min(8),
|
||||
});
|
||||
|
||||
|
|
@ -36,14 +35,14 @@ export async function POST(request: Request, { params }: { params: Promise<{ pix
|
|||
}
|
||||
|
||||
const { pixelId } = await params;
|
||||
const { name, domain, shareId } = body;
|
||||
const { name, slug } = body;
|
||||
|
||||
if (!(await canUpdatePixel(auth, pixelId))) {
|
||||
return unauthorized();
|
||||
}
|
||||
|
||||
try {
|
||||
const pixel = await updatePixel(pixelId, { name, domain, shareId });
|
||||
const pixel = await updatePixel(pixelId, { name, slug });
|
||||
|
||||
return Response.json(pixel);
|
||||
} catch (e: any) {
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ import { json, unauthorized } from '@/lib/response';
|
|||
import { uuid } from '@/lib/crypto';
|
||||
import { getQueryFilters, parseRequest } from '@/lib/request';
|
||||
import { pagingParams, searchParams } from '@/lib/schema';
|
||||
import { createPixel, getUserLinks } from '@/queries';
|
||||
import { createPixel, getUserPixels } from '@/queries';
|
||||
|
||||
export async function GET(request: Request) {
|
||||
const schema = z.object({
|
||||
|
|
@ -20,7 +20,7 @@ export async function GET(request: Request) {
|
|||
|
||||
const filters = await getQueryFilters(query);
|
||||
|
||||
const links = await getUserLinks(auth.user.id, filters);
|
||||
const links = await getUserPixels(auth.user.id, filters);
|
||||
|
||||
return json(links);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue