Skip to content

Commit ab4c668

Browse files
committed
add routing from settings -> reset password
1 parent b197335 commit ab4c668

File tree

2 files changed

+9
-11
lines changed

2 files changed

+9
-11
lines changed

src/app/reset-password/page.tsx

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,9 @@
11
"use client"
22

3-
// import Link from 'next/link';
4-
import { useRouter } from 'next/navigation';
53
import { useState } from 'react';
4+
import { useRouter } from 'next/navigation';
65
import supabase from '../../api/supabase/createClient';
76

8-
9-
10-
117
export default function ResetPassword() {
128
const [newPassword, setPassword] = useState('');
139
const { push } = useRouter();

src/app/settings/page.tsx

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,19 @@
11
'use client'
22

3+
import { useRouter } from 'next/navigation';
34
import supabase from '../../api/supabase/createClient';
45

56
export default function Settings() {
7+
const { push } = useRouter();
68
const signOut = async () => {
79
const { error } = await supabase.auth.signOut()
10+
if (error) {
11+
throw new Error(`An error occurred trying to sign out: ${error}`);
12+
}
13+
push("/login");
814
}
9-
const resetPassword = async () => {
10-
const e = '[email protected]' // pull email from profiles
11-
const url = 'http://example.com/account/update-password'
12-
await supabase.auth.resetPasswordForEmail(e, {
13-
redirectTo: url,
14-
})
15+
const resetPassword = () => {
16+
push("/reset-password");
1517
}
1618

1719
return (

0 commit comments

Comments
 (0)