MVP ready to test
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
import React, { useState } from 'react';
|
||||
import { Button } from '@/components/ui/Button';
|
||||
import { showToast } from '@/components/ui/Toast';
|
||||
import { useCsrf } from '@/hooks/useCsrf';
|
||||
|
||||
interface ChangePasswordModalProps {
|
||||
isOpen: boolean;
|
||||
@@ -15,6 +16,7 @@ export default function ChangePasswordModal({
|
||||
onClose,
|
||||
onSuccess,
|
||||
}: ChangePasswordModalProps) {
|
||||
const { fetchWithCsrf } = useCsrf();
|
||||
const [currentPassword, setCurrentPassword] = useState('');
|
||||
const [newPassword, setNewPassword] = useState('');
|
||||
const [confirmPassword, setConfirmPassword] = useState('');
|
||||
@@ -47,9 +49,8 @@ export default function ChangePasswordModal({
|
||||
setLoading(true);
|
||||
|
||||
try {
|
||||
const response = await fetch('/api/user/password', {
|
||||
const response = await fetchWithCsrf('/api/user/password', {
|
||||
method: 'PATCH',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({
|
||||
currentPassword,
|
||||
newPassword,
|
||||
|
||||
Reference in New Issue
Block a user