Skip to content

Commit

Permalink
add routing from settings -> reset password
Browse files Browse the repository at this point in the history
  • Loading branch information
ccatherinetan committed Oct 10, 2023
1 parent b197335 commit ab4c668
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 11 deletions.
6 changes: 1 addition & 5 deletions src/app/reset-password/page.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,9 @@
"use client"

// import Link from 'next/link';
import { useRouter } from 'next/navigation';
import { useState } from 'react';
import { useRouter } from 'next/navigation';
import supabase from '../../api/supabase/createClient';




export default function ResetPassword() {
const [newPassword, setPassword] = useState('');
const { push } = useRouter();
Expand Down
14 changes: 8 additions & 6 deletions src/app/settings/page.tsx
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
'use client'

import { useRouter } from 'next/navigation';
import supabase from '../../api/supabase/createClient';

export default function Settings() {
const { push } = useRouter();
const signOut = async () => {
const { error } = await supabase.auth.signOut()
if (error) {
throw new Error(`An error occurred trying to sign out: ${error}`);
}
push("/login");
}
const resetPassword = async () => {
const e = '[email protected]' // pull email from profiles
const url = 'http://example.com/account/update-password'
await supabase.auth.resetPasswordForEmail(e, {
redirectTo: url,
})
const resetPassword = () => {
push("/reset-password");
}

return (
Expand Down

0 comments on commit ab4c668

Please sign in to comment.