dauth-context-react 0.1.4 → 0.1.5

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.
Files changed (2) hide show
  1. package/README.md +15 -17
  2. package/package.json +7 -2
package/README.md CHANGED
@@ -4,7 +4,7 @@ This is a simple example of how to use a custom `DauthProvider`, and how to util
4
4
  ## Installation
5
5
  You can install this package via npm. Make sure you have Node.js installed on your machine. Then, in your project directory, run the following command:
6
6
  ```bash
7
- npm install dauth-react-context
7
+ npm install dauth-context-react
8
8
  ```
9
9
 
10
10
  ## Code Example
@@ -14,33 +14,31 @@ import React from 'react';
14
14
  import ReactDOM from 'react-dom';
15
15
  import { RouterProvider } from 'react-router-dom';
16
16
  import router from './router/router';
17
- import { DauthProvider } from 'dauth-react-context';
17
+ import { DauthProvider } from 'dauth-context-react';
18
18
 
19
19
  ReactDOM.render(
20
- <React.StrictMode>
21
- <DauthProvider
22
- domainName={domainName}
23
- sid={sid}
24
- ssid={ssid}
25
- >
26
- <RouterProvider
27
- router={router}
28
- fallbackElement={<></>}
29
- />
30
- </DauthProvider>
31
- </React.StrictMode>,
20
+ <DauthProvider
21
+ domainName={domainName}
22
+ sid={sid}
23
+ ssid={ssid}
24
+ >
25
+ <RouterProvider
26
+ router={router}
27
+ fallbackElement={<></>}
28
+ />
29
+ </DauthProvider>,
32
30
  document.getElementById('root')
33
31
  );
34
32
  ```
35
33
 
36
34
  ## Example: Using Authentication Context
37
- Here's an example of how to use the authentication context (dauth-react-context) in your components:
35
+ Here's an example of how to use the authentication context (dauth-context-react) in your components:
38
36
  ```
39
37
  import React, { useContext } from 'react';
40
- import { DauthContext } from 'dauth-react-context';
38
+ import { useDauth } from 'dauth-context-react';
41
39
 
42
40
  function SomeComponent() {
43
- const { isAuthenticated, isLoading, user, loginWithRedirect, logout, getAccessToken } = useContext(DauthContext);
41
+ const { isAuthenticated, isLoading, user, loginWithRedirect, logout, getAccessToken } = useDauth();
44
42
 
45
43
  return (
46
44
  isLoading ? <div>Loading...</div> :
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "0.1.4",
2
+ "version": "0.1.5",
3
3
  "license": "MIT",
4
4
  "main": "dist/index.js",
5
5
  "typings": "dist/index.d.ts",
@@ -57,5 +57,10 @@
57
57
  "tsdx": "^0.14.1",
58
58
  "tslib": "^2.6.2",
59
59
  "typescript": "^3.9.10"
60
- }
60
+ },
61
+ "keywords": [
62
+ "react",
63
+ "context",
64
+ "authentication"
65
+ ]
61
66
  }