Skip to content

Commit fc1dd25

Browse files
authored
Merge pull request #2 from kiwicopple/thor/supabase-auth-api
Bump gotrue-js
2 parents 08dc857 + 0b8a6b6 commit fc1dd25

File tree

7 files changed

+56
-24
lines changed

7 files changed

+56
-24
lines changed

example/next-todo/components/Auth.js

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,21 @@ export default function Auth({}) {
2323
if (error) console.log('Error: ', error.message)
2424
}
2525

26+
async function forgotPassword(e) {
27+
e.preventDefault()
28+
var email = prompt('Please enter your email:')
29+
if (email === null || email === '') {
30+
window.alert('You must enter your email.')
31+
} else {
32+
let { error } = await supabase.auth.api.resetPasswordForEmail(email)
33+
if (error) {
34+
console.log('Error: ', error.message)
35+
} else {
36+
alert('Password recovery email has been sent.')
37+
}
38+
}
39+
}
40+
2641
return (
2742
<div className="w-full sm:w-1/2 xl:w-1/3">
2843
<div className="border-teal p-8 border-t-12 bg-white mb-6 rounded-lg shadow-lg bg-white">
@@ -69,7 +84,19 @@ export default function Auth({}) {
6984
Login
7085
</a>
7186
</div>
72-
<div className="mt-6">
87+
88+
<div className="mt-2 text-sm leading-5">
89+
{/* eslint-disable-next-line */}
90+
<a
91+
onClick={forgotPassword}
92+
href="/"
93+
className="font-medium text-indigo-600 hover:text-indigo-500 focus:outline-none focus:underline transition ease-in-out duration-150"
94+
>
95+
Forgot your password?
96+
</a>
97+
</div>
98+
99+
<div className="mt-4">
73100
<div className="relative">
74101
<div className="absolute inset-0 flex items-center">
75102
<div className="w-full border-t border-gray-300"></div>

example/next-todo/components/TodoList.js

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,12 @@ export default function Todos({ user }) {
2525
}, [])
2626

2727
const fetchTodos = async () => {
28-
try {
29-
let { error, data } = await supabase.from('todos').select().order('id')
30-
if (error) throw error
31-
setTodos(data)
32-
} catch (error) {
33-
console.log('error', error)
28+
let { error, data } = await supabase.from('todos').select().order('id')
29+
if (error) {
30+
console.log(error.message)
31+
return
3432
}
33+
setTodos(data)
3534
}
3635
const addTodo = async (taskText) => {
3736
try {

example/next-todo/package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

example/next-todo/pages/index.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,13 @@ export default function IndexPage() {
2323
style={{ minWidth: 250, maxWidth: 600, margin: 'auto' }}
2424
>
2525
<TodoList user={supabase.auth.currentUser} />
26-
<button className="btn-black w-full mt-12" onClick={() => supabase.auth.signOut()}>
26+
<button
27+
className="btn-black w-full mt-12"
28+
onClick={async () => {
29+
const { error } = await supabase.auth.signOut()
30+
if (error) console.log('Error logging out:', error.message)
31+
}}
32+
>
2733
Logout
2834
</button>
2935
</div>

example/next-ts/yarn.lock

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1134,17 +1134,17 @@
11341134
dependencies:
11351135
mkdirp "^1.0.4"
11361136

1137-
"@supabase/gotrue-js@^1.5.10":
1138-
version "1.5.10"
1139-
resolved "https://registry.yarnpkg.com/@supabase/gotrue-js/-/gotrue-js-1.5.10.tgz#bffb4d644b659ca5ad7606fb2a6e6bdad2bfeb8a"
1140-
integrity sha512-SAoT5znv6r/nasJQp35n72dYGkBMWgKsCHc45vrCu8M/XDNpU/9vN8TzzziK4M0tWg3LGKm7MbRkNOwLEk5a8A==
1137+
"@supabase/gotrue-js@^1.6.0":
1138+
version "1.6.0"
1139+
resolved "https://registry.yarnpkg.com/@supabase/gotrue-js/-/gotrue-js-1.6.0.tgz#114a510eecc3ccc342549c2ece2c74fc7a2b63ca"
1140+
integrity sha512-dlaadRUb/1L65cyovDqHZLbnecM2kHVYyu/fH6ePaQdNq4NJJUprJY/PqhrHDtCP2LByCfd9GBcWq35bXOzJ+A==
11411141
dependencies:
11421142
cross-fetch "^3.0.6"
11431143

1144-
"@supabase/postgrest-js@^0.21.0":
1145-
version "0.21.0"
1146-
resolved "https://registry.yarnpkg.com/@supabase/postgrest-js/-/postgrest-js-0.21.0.tgz#e8970a67cbc6372420d66d39c5d1246e684b38a9"
1147-
integrity sha512-2MxPodIf1Ij+iR2RYVxziZpBv/9j6zT2d2UWSvdu2GT8yODo1hO2oXXT4cFJqvxmVX6A+z4J39wBqutt9vlttQ==
1144+
"@supabase/postgrest-js@^0.21.1":
1145+
version "0.21.1"
1146+
resolved "https://registry.yarnpkg.com/@supabase/postgrest-js/-/postgrest-js-0.21.1.tgz#6e8f49558cbb9585c29e3bbf023251a34c0da8d5"
1147+
integrity sha512-KHM+cDaxI5iIXl8uXQPsxjRqZHRnltav4Yq8juehn3wkXxsZS01LT6E3zdGn401a/yZgiJJWAp0m31BAql27vg==
11481148
dependencies:
11491149
cross-fetch "^3.0.6"
11501150

@@ -1160,8 +1160,8 @@
11601160
"@supabase/supabase-js@file:../..":
11611161
version "0.0.0"
11621162
dependencies:
1163-
"@supabase/gotrue-js" "^1.5.10"
1164-
"@supabase/postgrest-js" "^0.21.0"
1163+
"@supabase/gotrue-js" "^1.6.0"
1164+
"@supabase/postgrest-js" "^0.21.1"
11651165
"@supabase/realtime-js" "^1.0.6"
11661166

11671167
"@types/json-schema@^7.0.5":

package-lock.json

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
"docs:json": "typedoc --json docs/spec.json --mode modules --includeDeclarations --excludeExternals"
3131
},
3232
"dependencies": {
33-
"@supabase/gotrue-js": "^1.6.0",
33+
"@supabase/gotrue-js": "^1.6.1",
3434
"@supabase/postgrest-js": "^0.21.1",
3535
"@supabase/realtime-js": "^1.0.6"
3636
},

0 commit comments

Comments
 (0)