Fix website reports route type error and pass teamId to board WebsiteSelect.
Remove invalid 3rd parameter from GET handler and parse report type from query params instead. Pass teamId to WebsiteSelect in BoardEditHeader so it shows team websites in team context. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.6
parent
fed8d4c71a
commit
f595da612c
@@ -14,7 +14,7 @@ import { WebsiteSelect } from '@/components/input/WebsiteSelect';
|
||||
export function BoardEditHeader() {
|
||||
const { board, updateBoard, saveBoard, isPending } = useBoard();
|
||||
const { formatMessage, labels } = useMessages();
|
||||
const { router, renderUrl } = useNavigation();
|
||||
const { teamId, router, renderUrl } = useNavigation();
|
||||
const defaultName = formatMessage(labels.untitled);
|
||||
|
||||
const handleNameChange = (value: string) => {
|
||||
@@ -81,7 +81,11 @@ export function BoardEditHeader() {
|
||||
</Row>
|
||||
<Row alignItems="center" gap="3">
|
||||
<Text>{formatMessage(labels.website)}</Text>
|
||||
<WebsiteSelect websiteId={board?.parameters?.websiteId} onChange={handleWebsiteChange} />
|
||||
<WebsiteSelect
|
||||
websiteId={board?.parameters?.websiteId}
|
||||
teamId={teamId}
|
||||
onChange={handleWebsiteChange}
|
||||
/>
|
||||
</Row>
|
||||
</Column>
|
||||
<Column justifyContent="center" alignItems="flex-end">
|
||||
|
||||
@@ -1,17 +1,16 @@
|
||||
import { z } from 'zod';
|
||||
import { parseRequest } from '@/lib/request';
|
||||
import { json, unauthorized } from '@/lib/response';
|
||||
import { filterParams, pagingParams } from '@/lib/schema';
|
||||
import { pagingParams, reportTypeParam } from '@/lib/schema';
|
||||
import { canViewWebsite } from '@/permissions';
|
||||
import { getReports } from '@/queries/prisma';
|
||||
|
||||
export async function GET(
|
||||
request: Request,
|
||||
{ params }: { params: Promise<{ websiteId: string }> },
|
||||
filters: { type: string },
|
||||
) {
|
||||
const schema = z.object({
|
||||
...filterParams,
|
||||
type: reportTypeParam.optional(),
|
||||
...pagingParams,
|
||||
});
|
||||
|
||||
@@ -22,7 +21,7 @@ export async function GET(
|
||||
}
|
||||
|
||||
const { websiteId } = await params;
|
||||
const { page, pageSize, search } = query;
|
||||
const { type, page, pageSize, search } = query;
|
||||
|
||||
if (!(await canViewWebsite(auth, websiteId))) {
|
||||
return unauthorized();
|
||||
@@ -32,7 +31,7 @@ export async function GET(
|
||||
{
|
||||
where: {
|
||||
websiteId,
|
||||
type: filters.type,
|
||||
type,
|
||||
},
|
||||
},
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user