<?php

namespace App\Domains\UserManagement\Controllers;

use App\Providers\InertiaProvider;
use App\Scopes\CommonController;

class ProfileController extends CommonController
{
    public function __invoke()
    {
        if (!$this->checkAuth()) {
            return redirect()->intended('/login');
        }

        $user = auth()->user();

        $inertiaProvider = new InertiaProvider('UserManagement/Profile', [
            'username' => $user->username,
        ]);

        return $inertiaProvider->render();
    }
}
