@fluoce/auth-react 0.1.0 → 0.1.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.
Files changed (2) hide show
  1. package/README.md +6 -13
  2. package/package.json +7 -6
package/README.md CHANGED
@@ -7,14 +7,14 @@ tokens in cookies, and gives you `AuthGuard` + `useFluoceAuth()`.
7
7
 
8
8
  ```tsx
9
9
  // App.tsx
10
- import { FluoceAuthProvider } from '@fluoce/auth-react';
10
+ import { FluoceAuthProvider } from "@fluoce/auth-react";
11
11
 
12
12
  export function App() {
13
13
  return (
14
14
  <FluoceAuthProvider
15
15
  authUrl="https://auth.fluoce.com"
16
- apiUrl="https://api.fluoce.com" // your auth backend
17
- appUrl="https://myapp.com/auth" // this app's callback url (the `ref`)
16
+ apiUrl="https://auth-service.fluoce.com"
17
+ appUrl="https://myapp.com/auth" // this app's callback url (the `ref`)
18
18
  >
19
19
  <Routes />
20
20
  </FluoceAuthProvider>
@@ -30,7 +30,7 @@ it, sets cookies, and strips it from the URL.
30
30
  ## Protecting a route
31
31
 
32
32
  ```tsx
33
- import { AuthGuard } from '@fluoce/auth-react';
33
+ import { AuthGuard } from "@fluoce/auth-react";
34
34
 
35
35
  function DashboardPage() {
36
36
  return (
@@ -47,20 +47,13 @@ If there's no valid session, `AuthGuard` redirects to
47
47
  ## Reading the user / calling other endpoints
48
48
 
49
49
  ```tsx
50
- import { useFluoceAuth } from '@fluoce/auth-react';
50
+ import { useFluoceAuth } from "@fluoce/auth-react";
51
51
 
52
52
  function Profile() {
53
- const { user, loading, logout, authFetch } = useFluoceAuth();
53
+ const { user, loading, logout } = useFluoceAuth();
54
54
 
55
55
  if (loading) return <Spinner />;
56
56
 
57
- const updateName = (name: string) =>
58
- authFetch('/me', {
59
- method: 'POST',
60
- headers: { 'Content-Type': 'application/json' },
61
- body: JSON.stringify({ name }),
62
- });
63
-
64
57
  return (
65
58
  <div>
66
59
  <p>{user?.name ?? user?.email}</p>
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "@fluoce/auth-react",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "React SDK for Fluoce Auth",
5
5
  "license": "MIT",
6
6
  "type": "module",
7
- "main": "./dist/index.js",
8
- "module": "./dist/index.mjs",
7
+ "main": "./dist/index.cjs",
8
+ "module": "./dist/index.js",
9
9
  "types": "./dist/index.d.ts",
10
10
  "publishConfig": {
11
11
  "access": "public"
@@ -13,12 +13,13 @@
13
13
  "exports": {
14
14
  ".": {
15
15
  "types": "./dist/index.d.ts",
16
- "import": "./dist/index.mjs",
17
- "require": "./dist/index.js"
16
+ "import": "./dist/index.js",
17
+ "require": "./dist/index.cjs"
18
18
  }
19
19
  },
20
20
  "files": [
21
- "dist"
21
+ "dist",
22
+ "README.md"
22
23
  ],
23
24
  "sideEffects": false,
24
25
  "scripts": {