authera 1.0.0 → 1.1.0
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/dist/index.d.ts +1 -0
- package/dist/index.js +6 -0
- package/package.json +3 -2
package/dist/index.d.ts
CHANGED
|
@@ -19,5 +19,6 @@ export default function AuthHook<T extends string>(props: AuthHookSettings<T>):
|
|
|
19
19
|
fallback_401_url: string;
|
|
20
20
|
isPermittedAll: (perms: T[]) => boolean;
|
|
21
21
|
};
|
|
22
|
+
LoginScenario: () => import("react/jsx-runtime").JSX.Element;
|
|
22
23
|
};
|
|
23
24
|
export { default as AuthGuard } from "./web/guard";
|
package/dist/index.js
CHANGED
|
@@ -3,14 +3,20 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
3
3
|
import { name2storage } from "./helper/storage";
|
|
4
4
|
import AuthProvider from "./web";
|
|
5
5
|
import { useAuth } from "./hooks/useAuth";
|
|
6
|
+
import axios from "axios";
|
|
6
7
|
export default function AuthHook(props) {
|
|
7
8
|
// set storage functions
|
|
8
9
|
let storage = props.storage;
|
|
9
10
|
if (typeof storage === "string")
|
|
10
11
|
storage = name2storage(storage);
|
|
12
|
+
// fetch optoins from backend
|
|
13
|
+
const backend_url = props.backendUrl + "/options";
|
|
14
|
+
const response = axios.get(backend_url);
|
|
15
|
+
// create backend data
|
|
11
16
|
return {
|
|
12
17
|
createAuthProvider: (children) => (_jsx(AuthProvider, { storage: storage, fallback_401_url: props.fallback_401_url, children: children })),
|
|
13
18
|
useAuth: () => useAuth(),
|
|
19
|
+
LoginScenario: () => _jsx("p", {})
|
|
14
20
|
};
|
|
15
21
|
}
|
|
16
22
|
export { default as AuthGuard } from "./web/guard";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "authera",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"description": "this project is a simple auth hook for react",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -38,6 +38,7 @@
|
|
|
38
38
|
"react": "^18 || ^19"
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
|
+
"axios": "^1.13.2",
|
|
41
42
|
"js-cookie": "^3.0.5"
|
|
42
43
|
}
|
|
43
|
-
}
|
|
44
|
+
}
|