All files / src type.ts

100% Statements 12/12
100% Branches 0/0
100% Functions 0/0
100% Lines 12/12

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125    4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x                                                                                                                                                                                                                              
import {Activity} from "./generated/api";
 
export const ADD_ACTIVITY_RQ = "ADD_ACTIVITY_RQ"
export const FETCH_ACTIVITY_RQ = "FETCH_ACTIVITY_RQ"
export const EDIT_ACTIVITY_RQ = "EDIT_ACTIVITY_RQ"
export const REMOVE_ACTIVITY_RQ = "REMOVE_ACTIVITY_RQ"
export const LOGIN_RQ = "LOGIN_RQ"
export const SET_ACTIVITIES = "SET_ACTIVITIES"
export const EDIT_ACTIVITY = "EDIT_ACTIVITY"
export const ADD_ACTIVITY = "ADD_ACTIVITY"
export const REMOVE_ACTIVITY = "REMOVE_ACTIVITY"
export const LOGIN = "LOGIN"
export const LOGIN_USERNAME = "LOGIN_USERNAME"
export const ERROR = "ERROR"
 
export interface AddActivityRequestAction {
    type: 'ADD_ACTIVITY_RQ'
}
 
export interface FetchActivityRequestAction {
    type: 'FETCH_ACTIVITY_RQ'
}
 
export interface EditActivityRequestAction {
    type: 'EDIT_ACTIVITY_RQ',
    payload: Activity
 
}
export interface LoginRequestRequestAction {
    type: 'LOGIN_RQ',
 
}
 
export interface EditActivityAction {
    type: 'EDIT_ACTIVITY',
    payload: Activity
 
}
 
export interface RemoveActivityRequestAction {
    type: 'REMOVE_ACTIVITY_RQ',
    payload: Activity
 
}
 
export interface SetActivitiesAction {
    type: 'SET_ACTIVITIES',
    payload: Activity[]
 
}
 
export interface AddActivityAction {
    type: 'ADD_ACTIVITY',
    payload: Activity
}
 
export interface RemoveActivityAction {
    type: 'REMOVE_ACTIVITY',
    payload: Activity
}
 
export interface LoginActivityAction {
    type: 'LOGIN',
    payload: string
}
 
export interface LoginUNActivityAction {
    type: 'LOGIN_USERNAME',
    payload: string
}
 
export interface ErrorAction {
    type: 'ERROR',
    payload: any
}
 
// Union Action Types
export type Action =
    AddActivityAction |
    AddActivityRequestAction |
    SetActivitiesAction |
    FetchActivityRequestAction |
    EditActivityAction |
    EditActivityRequestAction |
    RemoveActivityAction |
    RemoveActivityRequestAction |
    LoginActivityAction |
    LoginRequestRequestAction |
    LoginUNActivityAction |
    ErrorAction
 
 
/**
 * Progress info. Keep track of the current progress information
 */
export type ProgressInfo = {
    /**
     * true if the add action is in progress
     */
    add: boolean,
 
    /**
     * true if the fetch activities action is in progress
     */
    fetch: boolean,
 
    /**
     * edit {@link Activity} action is in progress
     * the edit state will keep the list of the {@link Activity#id}s that currently have the editing in progress.
     */
    edit: string[],
 
 
    /**
     * the remove {@link Activity} action is in progress
     * the edit state will keep the list of the {@link Activity#id}s that currently have the remove action in progress.
     */
    remove: string[],
}
 
 
export type DispatchType = (args: Action) => Action