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

atlp-rwanda / vikings-ec-fe / 232f6db9-b6f6-42a1-9aa1-11e087e2c026

pending completion
232f6db9-b6f6-42a1-9aa1-11e087e2c026

Pull #31

circleci

munezeroolivierhugue
feat: tract orders
Pull Request #31: #184759929 Implement Tracking Orders

338 of 660 branches covered (51.21%)

Branch coverage included in aggregate %.

64 of 64 new or added lines in 9 files covered. (100.0%)

1442 of 1902 relevant lines covered (75.81%)

21.77 hits per line

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

60.61
/src/features/notifications/getNotificationSlice.js
1
import { createSlice, createAsyncThunk } from '@reduxjs/toolkit';
2
import Endpoints from '../../utils/endpoints';
3
import axios from '../api/customAxios';
4

5
export const fetchNotifications = createAsyncThunk(
54✔
6
  'fetchNotifications',
7
  async (arg, { rejectWithValue }) => {
8
    try {
14✔
9
      const { data } = await axios.get(
14✔
10
        `${Endpoints.notifications}?limit=${arg?.limit || 10}&page=${arg?.page || 1}`,
55✔
11
      );
12
      return data.notifications;
9✔
13
    } catch (error) {
14
      return rejectWithValue(error.response);
×
15
    }
16
  },
17
);
18

19
export const notificationsSlice = createSlice({
54✔
20
  name: 'notifications',
21
  initialState: {
22
    notifications: [],
23
    pagination: {
24
      totalPages: 1,
25
      currentPage: 1,
26
      totalItems: 0,
27
    },
28
    isLoading: false,
29
    error: null,
30
  },
31
  reducers: {
32
    addNotifications: (state, action) => {
33
      state.notifications = [action.payload, ...state.notifications];
×
34
    },
35
    markOneAsRead: (state, { payload }) => {
36
      state.notifications = state.notifications.map((notification) => {
×
37
        if (notification.id === payload) {
×
38
          return { ...notification, isRead: true };
×
39
        }
40
        return notification;
×
41
      });
42
    },
43
    markAllAsRead: (state) => {
44
      state.notifications = state.notifications.map((notification) => (
×
45
        { ...notification, isRead: true }));
×
46
    },
47
  },
48
  extraReducers: {
49
    [fetchNotifications.pending]: (state) => {
50
      state.isLoading = true;
13✔
51
      state.error = null;
13✔
52
    },
53
    [fetchNotifications.fulfilled]: (state, action) => {
54
      const append = action?.meta?.arg?.append || false;
9✔
55
      state.notifications = append ? [...state.notifications, ...action.payload.rows]
9!
56
        : action.payload.rows;
57
      state.pagination = {
9✔
58
        totalPages: action.payload.totalPages,
59
        currentPage: action.payload.currentPage,
60
        totalItems: action.payload.totalItems,
61
      };
62
      state.isLoading = false;
9✔
63
      state.error = null;
9✔
64
    },
65
    [fetchNotifications.rejected]: (state, action) => {
66
      state.isLoading = false;
×
67
      state.error = action.payload;
×
68
    },
69
  },
70
});
71

72
export const { addNotifications, markOneAsRead, markAllAsRead } = notificationsSlice.actions;
54✔
73

74
export default notificationsSlice.reducer;
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

© 2026 Coveralls, Inc