• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

atlp-rwanda / champs-ec-fe / 13ba735d-90f9-49d3-9acb-f5a6c957f324

18 Jun 2024 10:20PM UTC coverage: 58.852% (-28.3%) from 87.175%
13ba735d-90f9-49d3-9acb-f5a6c957f324

Pull #13

circleci

k3lly003
Merge pull request #26 from atlp-rwanda/ft-disable-users-#187300202

Ft disable users #187300202
Pull Request #13: feat(ProductView): ProductView (all/one) according to there user's role #187300196

70 of 95 branches covered (73.68%)

Branch coverage included in aggregate %.

84 of 626 new or added lines in 24 files covered. (13.42%)

219 existing lines in 7 files now uncovered.

1366 of 2345 relevant lines covered (58.25%)

2.27 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

45.95
/src/hooks/reset.ts
1
'use client'
1✔
2
import passwordValidation from '@/validations/ResetValidation';
1✔
3
// import passwordValidation from '@/validations/resetValidation';
1✔
4
import axios from 'axios';
1✔
5
import { useRouter, useSearchParams } from 'next/navigation';
1✔
6

1✔
7
import { useState } from 'react';
1✔
8
import { z } from 'zod';
1✔
9

1✔
10
type FormField = z.infer<typeof passwordValidation>;
1✔
11
const ResetPassword = () => {
1✔
12
    const [errorMessage, setErrorMessage] = useState('');
2✔
13
    const [loading, setLoading] = useState(false);
2✔
14
    const URL = process.env.URL;
2✔
15
    const router=useRouter()
2✔
16
    const [error, setError] = useState('');
2✔
17
    const [success, setSuccess] = useState(false);
2✔
18
    const handlemoduleButton = () => {
2✔
19
         router.push('/auth/login');
×
20
        setSuccess(false);
×
21
      };
×
22

2✔
23
    const HandleReset = async (password: string, confirmPassword: string) => {
2✔
24
        setLoading(true);
×
25

×
26
        const searchParams = new URLSearchParams(window.location.search);
×
27
        const token = searchParams.get('token');
×
28
        console.log(password,confirmPassword)
×
29
    try {
×
30
        ('use server');
×
31
        const response = await axios.patch(
×
NEW
32
          `${process.env.URL}/users/reset-password/${token}`,
×
33
          {
×
34
            
×
35
                newPassword: password,
×
36
                confirmPassword: confirmPassword
×
37
    
×
38
          },
×
39
          {
×
40
            headers: {
×
41
              'Content-Type': 'application/json',
×
42
            },
×
43
          },
×
44
        );
×
45
        if (response) {
×
46
            console.log('RESPONSE',response)
×
47
          setLoading(false);
×
48
          setSuccess(true)
×
49

×
50
        }
×
51
      } catch (error: any) {
×
52
        console.log('Error',error)
×
53
        setLoading(false);
×
54
        setError(error.response.data.error);
×
55
        setErrorMessage('Invalid Email');
×
56
        return;
×
57
      }
×
58
    }
×
59
const sendPassword = async(password: string, confirmPassword: string) => {
2✔
60
    HandleReset(password,confirmPassword); 
×
61
  };
×
62
  
2✔
63
    return {
2✔
64
        errorMessage,
2✔
65
        setErrorMessage,
2✔
66
        loading,
2✔
67
        sendPassword,
2✔
68
        HandleReset,
2✔
69
        success,
2✔
70
        handlemoduleButton
2✔
71
      };
2✔
72
}
2✔
73
export default ResetPassword
1✔
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc