Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Авторизация на бэке
- class LoginController extends Controller
- {
- public function authenticate(Request $request)
- {
- $credentials = $request->only('name', 'password');
- if (Auth::attempt($credentials)) {
- return ['status' => 'success'];
- }
- return ['status' => 'error'];
- }
- Авторизация на фронте
- export async function login(name: "admin" | String, password: "admin" | String) {
- const payload = await request("POST", "/auth", {
- name, password
- })
- return handleError(payload)
- }
Add Comment
Please, Sign In to add comment