|
2 | 2 |
|
3 | 3 | `react-supabase` is a React Hooks library for [Supabase](https://supabase.io). |
4 | 4 |
|
5 | | -With `react-supabase`, components can request and access data declaratively without needing to handle state updates on their own. |
6 | | - |
7 | 5 | <br/> |
8 | 6 |
|
9 | 7 | ## Installation |
@@ -57,82 +55,6 @@ const Todos = () => { |
57 | 55 |
|
58 | 56 | <br/> |
59 | 57 |
|
60 | | -### API |
61 | | - |
62 | | -#### Auth |
63 | | - |
64 | | -```js |
65 | | -useAuthStateChange((event, session) => { |
66 | | - console.log(`Supbase auth event: ${event}`, session) |
67 | | -}) |
68 | | -``` |
69 | | - |
70 | | -```js |
71 | | -const [{ error, fetching }, resetPassword] = useResetPassword({ |
72 | | - options: { |
73 | | - redirectTo: 'https://example.com/welcome', |
74 | | - }, |
75 | | -}) |
76 | | - |
77 | | -const { error } = await resetPassword('user@example.com', { |
78 | | - redirectTo: 'https://example.com/reset', |
79 | | -}) |
80 | | -``` |
81 | | - |
82 | | -```js |
83 | | -const [{ error, fetching, user, session }, signIn] = useSignIn({ |
84 | | - // provider: 'github', |
85 | | - options: { |
86 | | - redirectTo: 'https://example.com/dashboard', |
87 | | - // scopes: 'repo gist notifications', |
88 | | - }, |
89 | | -}) |
90 | | - |
91 | | -const { error, session, user } = await signIn( |
92 | | - { |
93 | | - email: 'user@example.com', |
94 | | - password: 'foobarbaz', // omit for magic link |
95 | | - // provider: 'github', |
96 | | - }, |
97 | | - { |
98 | | - redirectTo: 'https://example.com/dashboard', |
99 | | - // scopes: 'repo gist notifications', |
100 | | - }, |
101 | | -) |
102 | | -``` |
103 | | - |
104 | | -```js |
105 | | -const [{ error, fetching }, signOut] = useSignOut() |
106 | | - |
107 | | -const { error } = await signOut() |
108 | | -``` |
109 | | - |
110 | | -```js |
111 | | -const [{ error, fetching, user, session }, signUp] = useSignUp({ |
112 | | - options: { |
113 | | - redirectTo: 'https://example.com/dashboard', |
114 | | - }, |
115 | | -}) |
116 | | - |
117 | | -const { error, session, user } = await signUp( |
118 | | - { |
119 | | - email: 'user@example.com', |
120 | | - password: 'foobarbaz', |
121 | | - }, |
122 | | - { |
123 | | - redirectTo: 'https://example.com/dashboard', |
124 | | - }, |
125 | | -) |
126 | | -``` |
127 | | - |
128 | | -#### Data |
129 | | - |
130 | | -#### Realtime |
131 | | - |
132 | | -#### Storage |
133 | | - |
134 | | -<br/> |
135 | | - |
136 | 58 | ## License |
137 | 59 |
|
138 | 60 | The MIT License. |
0 commit comments