mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-20 21:46:00 +00:00
openNewTab refactor
This commit is contained in:
@@ -1,19 +1,18 @@
|
||||
import React from 'react';
|
||||
import { useCurrentDatabase, useSetOpenedTabs } from '../utility/globalState';
|
||||
import { openNewTab } from '../utility/common';
|
||||
import axios from '../utility/axios';
|
||||
import useTheme from '../theme/useTheme';
|
||||
import { StyledThemedLink } from '../widgets/FormStyledButton';
|
||||
import useOpenNewTab from '../utility/useOpenNewTab';
|
||||
|
||||
export default function OpenChartLink({ file, children }) {
|
||||
const setOpenedTabs = useSetOpenedTabs();
|
||||
const openNewTab = useOpenNewTab();
|
||||
const currentDb = useCurrentDatabase();
|
||||
const theme = useTheme();
|
||||
|
||||
const handleClick = async () => {
|
||||
const resp = await axios.post('files/load', { folder: 'charts', file, format: 'json' });
|
||||
openNewTab(
|
||||
setOpenedTabs,
|
||||
{
|
||||
title: file,
|
||||
icon: 'img chart',
|
||||
|
||||
Reference in New Issue
Block a user