Skip to content

Commit 9b6ab19

Browse files
committed
redirect chart preview page
1 parent 71c7b7e commit 9b6ab19

File tree

1 file changed

+9
-5
lines changed
  • app/[locale]/dashboard/[entityType]/[entitySlug]/charts/components

1 file changed

+9
-5
lines changed

app/[locale]/dashboard/[entityType]/[entitySlug]/charts/components/ChartsList.tsx

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { UUID } from 'crypto';
22
import React, { useEffect, useState } from 'react';
33
import Link from 'next/link';
4-
import { useParams } from 'next/navigation';
4+
import { useParams, useRouter } from 'next/navigation';
55
import { graphql } from '@/gql';
66
import { useMutation, useQuery } from '@tanstack/react-query';
77
import {
@@ -113,6 +113,8 @@ const ChartsList: React.FC<ChartsListProps> = ({
113113
id: string;
114114
}>();
115115

116+
const router = useRouter();
117+
116118
const [editorView, setEditorView] = useState(false);
117119

118120
const chartListRes: {
@@ -250,11 +252,13 @@ const ChartsList: React.FC<ChartsListProps> = ({
250252

251253
const handleChart = (row: any) => {
252254
if (row.original.typename === 'TypeResourceChart') {
253-
setType('visualize');
254-
setChartId(row.original.id);
255+
router.push(
256+
`/dashboard/${params.entityType}/${params.entitySlug}/charts/${row.original.id}?type=TypeResourceChart`
257+
);
255258
} else {
256-
setType('img');
257-
setImageId(row.original.id);
259+
router.push(
260+
`/dashboard/${params.entityType}/${params.entitySlug}/charts/${row.original.id}?type=TypeResourceChartImage`
261+
);
258262
}
259263
};
260264

0 commit comments

Comments
 (0)