diff --git a/src/components/Dash/index.tsx b/src/components/Dash/index.tsx index 5ad0359..ec9d226 100644 --- a/src/components/Dash/index.tsx +++ b/src/components/Dash/index.tsx @@ -3,6 +3,7 @@ import { useEffect, useState } from 'react' import Collapsible from 'react-collapsible' import { useData } from '../../hooks/useData' +import type { Data } from '../../types/Data' import { getLocalStorageData, setLocalStorageData } from '../../utils/localStorage' import { Home } from '../Home' import { ColorsSettings } from './ColorsSettings' @@ -10,12 +11,15 @@ import { DataSettings } from './DataSettings' import { SaveChangesAlert } from './SaveChangesAlert' import { Content, Preview, Wrapper } from './styles' -export function Dash() { +type DashProps = { + initialData: Data +} + +export function Dash({ initialData }: DashProps) { const { data, setData } = useData() const [isLoading, setIsLoading] = useState(true) const [hasUnsavedChanges, setHasUnsavedChanges] = useState(false) const [activeTab, setActiveTab] = useState<'data' | 'colors'>('data') - const initialData = data useEffect(() => { if (isLoading) { diff --git a/src/pages/dash.tsx b/src/pages/dash.tsx index 3364ded..6f49486 100644 --- a/src/pages/dash.tsx +++ b/src/pages/dash.tsx @@ -2,9 +2,14 @@ import { GetServerSideProps } from 'next' import { Dash } from '../components/Dash' import { fetchData } from '../services/fetchData' +import type { Data } from '../types/Data' -export default function DashPage() { - return +type DashPageProps = { + initialData: Data +} + +export default function DashPage({ initialData }: DashPageProps) { + return } export const getServerSideProps: GetServerSideProps = async () => {