import { route } from 'preact-router' import { useState } from 'preact/hooks' import { isAdministrator, Solution as SolutionModel, User } from '../../shared/model' import { server } from '../api' import { Header } from '../components/Header' import { Select } from '../components/Select' import { Solution } from '../components/Solution' import { useCurrentUser, useReadResource } from '../hooks' const SolutionList = ({ user }: { user: User }) => { const [solutions, refresh] = useReadResource( `/api/solutions?user=${user.id}`, [] ) return (
{solutions.map(({ forProblem, content, status }) => ( ))}
) } export const ProfilePage = ({}) => { const [user, logout] = useCurrentUser(user => { if (!user) { route('/login', true) } }) const handleLogout = () => { logout() route('/') } return ( user && (
Le tue soluzioni
Altro
) ) }