export default function Auth() {
function submit(event) {
event.preventDefault()
const elements = event.currentTarget.elements
if (elements) {
const name = elements.namedItem("name").value
const password = elements.namedItem("password").value
Links.login(name, password).then(()=>window.location.reload())
}
}
export async function logIn(name: "admin" | String, password: "admin" | String) {
const payload = await request("POST", "/auth", {
name, password
})
class LoginController extends Controller
{
public function authenticate(Request $request)
{
$credentials = $request->only('name', 'password');
if (Auth::attempt($credentials)) {
return ['status' => 'success'];
}
return ['status' => 'error'];
}