<?php
require_once __DIR__ . '/../../_bootstrap.php';
require_once ROOT_PATH . '/includes/match_functions.php';
require_once ROOT_PATH . '/includes/viral_functions.php';
$u=afApiOuSessaoUsuario($pdo);
if($_SERVER['REQUEST_METHOD']!=='GET')jsonResponse(['ok'=>false,'erro'=>'Método não permitido.'],405);
$r=afResumoViral($pdo,(int)$u['id']);
if(!empty($r['convite']['codigo']))$r['convite']['url']=SITE_URL.'/auth/login.php?ref='.$r['convite']['codigo'];
jsonResponse(['ok'=>true,'viral'=>$r]);
