• 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

72.84
/src/redux/slices/UpdatePasswordSlice.ts
1
import { createSlice, PayloadAction, createAsyncThunk } from '@reduxjs/toolkit';
1✔
2
import axios from 'axios';
1✔
3

1✔
4
export interface UpdatePasswordState {
1✔
5
    loading: boolean;
1✔
6
    error: String | null;
1✔
7
}
1✔
8

1✔
9
const initialState: UpdatePasswordState = {
1✔
10
    loading: false,
1✔
11
    error: '',
1✔
12
};
1✔
13

1✔
14
export interface PasswordData {
1✔
15
    oldPassword: string;
1✔
16
    newPassword: string;
1✔
17
    confirmPassword: string;
1✔
18
}
1✔
19
export const updatePassword = createAsyncThunk(
1✔
20
    'updatepassword',
1✔
21
    async (FormData: PasswordData) => {
1✔
22
        const token = localStorage.getItem('token');
×
23

×
24
        try {
×
25
            const response = await axios.patch(
×
NEW
26
                `${process.env.URL}/users/passwordUpdate`,
×
27
                {
×
28
                    oldPassword: FormData.oldPassword,
×
29
                    newPassword: FormData.newPassword,
×
30
                    confirmPassword: FormData.confirmPassword,
×
31
                },
×
32
                {
×
33
                    headers: {
×
34
                        'Content-Type': 'application/json',
×
35
                        Authorization: token,
×
36
                    },
×
37
                },
×
38
            );
×
39
            return response;
×
40
        } catch (error: any) {
×
41
            return error;
×
42
        }
×
43
    },
×
44
);
1✔
45
const updatePasswordSlice = createSlice({
1✔
46
    name: 'updatePassword',
1✔
47
    initialState,
1✔
48

1✔
49
    reducers: {
1✔
50
        clearError(state) {
1✔
51
            state.error = '';
1✔
52
        },
1✔
53
    },
1✔
54
    extraReducers(builder) {
1✔
55
        builder.addCase(updatePassword.pending, (state, action) => {
5✔
56
            state.loading = true;
1✔
57
            state.error = null;
1✔
58
        });
1✔
59
        builder.addCase(updatePassword.fulfilled, (state, action) => {
5✔
60
            state.loading = false;
2✔
61
            if (
2✔
62
                action.payload &&
2✔
63
                action.payload.response &&
2✔
64
                action.payload.response.data.error
1✔
65
            ) {
2✔
66
                state.error = action.payload.response.data.error;
1✔
67
            } else {
1✔
68
                state.error = '';
1✔
69
            }
1✔
70
        });
2✔
71
    },
5✔
72
});
1✔
73
export const { clearError } = updatePasswordSlice.actions;
1✔
74

1✔
75
export default updatePasswordSlice.reducer;
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