Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • pages/index/+Page.tsx

    rf727252 r5af32f0  
    1010import BuildCard from '../../components/BuildCard';
    1111
    12 import {onGetApprovedBuilds, onGetAuthState} from '../+Layout.telefunc';
     12import {onGetApprovedBuilds, onGetAuthState, onCloneBuild} from '../+Layout.telefunc';
    1313
    1414export default function HomePage() {
     
    4646        }
    4747
    48         void loadSite();
     48        loadSite();
    4949    }, []);
     50
     51    const handleCloneWrapper = async (buildId: number) => {
     52        if (!data?.isLoggedIn) return alert("Please login to clone builds!");
     53        if (confirm(`Clone this build to your dashboard?`)) {
     54            await onCloneBuild({buildId});
     55            alert("Build cloned! Check your dashboard.");
     56            setSelectedBuildId(null);
     57        }
     58    };
    5059
    5160    if (!data) return <Box sx={{p: 10, textAlign: 'center'}}>Loading Forge...</Box>;
     
    151160                currentUser={data.userId}
    152161                onClose={() => setSelectedBuildId(null)}
     162                onClone={handleCloneWrapper}
    153163            />
    154164
Note: See TracChangeset for help on using the changeset viewer.