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