1.0.0 • Published 6 months ago

next-lara-auth-sdk v1.0.0

Weekly downloads
-
License
MIT
Repository
-
Last release
6 months ago

Auth SDK

A simple authentication SDK for Laravel API.

Installation

npm install next-lara-auth-sdk



### Example

import { createAuthClient } from 'next-lara-auth-sdk';

const authClient = createAuthClient('http://localhost:8000');

export async function loginAction(prevState, formData) {
  try {
    const response = await authClient.login(formData);
    if (response.statutCode === 200)
      return {
        success: true,
        message: "Login successful!",
        data: response.data,
      };
    return { success: false, message: "Login failed" };
  } catch (error) {
    return { success: false, message: "Login failed" };
  }
}
1.0.0

6 months ago