@vergeinfosoft/react 1.0.0 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +10 -10
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
# @
|
|
1
|
+
# @vergeinfosoft/react
|
|
2
2
|
|
|
3
3
|
React SDK for Verge Auth - Single-line authentication integration for your React applications.
|
|
4
4
|
|
|
5
5
|
## Installation
|
|
6
6
|
|
|
7
7
|
```bash
|
|
8
|
-
npm install @
|
|
8
|
+
npm install @vergeinfosoft/react
|
|
9
9
|
```
|
|
10
10
|
|
|
11
11
|
## Quick Start
|
|
@@ -15,7 +15,7 @@ npm install @verge-auth/react
|
|
|
15
15
|
Wrap your entire app with the `VergeAuth` component:
|
|
16
16
|
|
|
17
17
|
```jsx
|
|
18
|
-
import { VergeAuth } from '@
|
|
18
|
+
import { VergeAuth } from '@vergeinfosoft/react';
|
|
19
19
|
|
|
20
20
|
function App() {
|
|
21
21
|
return (
|
|
@@ -31,7 +31,7 @@ That's it! Your app is now protected with Verge Auth.
|
|
|
31
31
|
### With Custom Configuration
|
|
32
32
|
|
|
33
33
|
```jsx
|
|
34
|
-
import { VergeAuth } from '@
|
|
34
|
+
import { VergeAuth } from '@vergeinfosoft/react';
|
|
35
35
|
|
|
36
36
|
function App() {
|
|
37
37
|
return (
|
|
@@ -39,7 +39,7 @@ function App() {
|
|
|
39
39
|
config={{
|
|
40
40
|
apiBaseUrl: '/api',
|
|
41
41
|
authEndpoint: '/auth/me',
|
|
42
|
-
loginUrl: 'https://
|
|
42
|
+
loginUrl: 'https://app.vergeauth.in/login',
|
|
43
43
|
logoutUrl: '/auth/logout',
|
|
44
44
|
redirectUrl: window.location.origin
|
|
45
45
|
}}
|
|
@@ -56,7 +56,7 @@ function App() {
|
|
|
56
56
|
Set these in your `.env` file:
|
|
57
57
|
|
|
58
58
|
```env
|
|
59
|
-
VITE_VERGEAUTH_LOGIN_URL=https://
|
|
59
|
+
VITE_VERGEAUTH_LOGIN_URL=https://app.vergeauth.in/login
|
|
60
60
|
```
|
|
61
61
|
|
|
62
62
|
## Advanced Usage
|
|
@@ -66,7 +66,7 @@ VITE_VERGEAUTH_LOGIN_URL=https://auth.vergeinfosoft.com/login
|
|
|
66
66
|
If you need more control, you can use the individual components:
|
|
67
67
|
|
|
68
68
|
```jsx
|
|
69
|
-
import { AuthProvider, useAuth, ProtectedRoute } from '@
|
|
69
|
+
import { AuthProvider, useAuth, ProtectedRoute } from '@vergeinfosoft/react';
|
|
70
70
|
import { BrowserRouter, Routes, Route } from 'react-router-dom';
|
|
71
71
|
|
|
72
72
|
function App() {
|
|
@@ -90,7 +90,7 @@ function App() {
|
|
|
90
90
|
### Permission-Based Route Protection
|
|
91
91
|
|
|
92
92
|
```jsx
|
|
93
|
-
import { ProtectedRoute } from '@
|
|
93
|
+
import { ProtectedRoute } from '@vergeinfosoft/react';
|
|
94
94
|
|
|
95
95
|
function Dashboard() {
|
|
96
96
|
return (
|
|
@@ -104,7 +104,7 @@ function Dashboard() {
|
|
|
104
104
|
### Using the Auth Hook
|
|
105
105
|
|
|
106
106
|
```jsx
|
|
107
|
-
import { useAuth } from '@
|
|
107
|
+
import { useAuth } from '@vergeinfosoft/react';
|
|
108
108
|
|
|
109
109
|
function UserProfile() {
|
|
110
110
|
const { isAuthenticated, loading, permissions, hasPermission, login, logout } = useAuth();
|
|
@@ -233,7 +233,7 @@ Your backend must:
|
|
|
233
233
|
## Example: Full HRMS Integration
|
|
234
234
|
|
|
235
235
|
```jsx
|
|
236
|
-
import { VergeAuth, ProtectedRoute, useAuth } from '@
|
|
236
|
+
import { VergeAuth, ProtectedRoute, useAuth } from '@vergeinfosoft/react';
|
|
237
237
|
|
|
238
238
|
const PERMISSIONS = {
|
|
239
239
|
DASHBOARD_GET: "hrms-service:/api/dashboard/stats:get",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vergeinfosoft/react",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "React SDK for Verge Auth - Single-line authentication integration",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -44,6 +44,6 @@
|
|
|
44
44
|
},
|
|
45
45
|
"repository": {
|
|
46
46
|
"type": "git",
|
|
47
|
-
"url": "https://github.com/vergeinfosoft/verge-auth-react-sdk"
|
|
47
|
+
"url": "git+https://github.com/vergeinfosoft/verge-auth-react-sdk.git"
|
|
48
48
|
}
|
|
49
49
|
}
|