All files / atlas/src globals.ts

55.56% Statements 5/9
0% Branches 0/2
0% Functions 0/1
55.56% Lines 5/9

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        7x       7x   7x                         7x   7x                
import { AxiosError, AxiosPromise, AxiosResponse } from "axios";
import { ImageURISource } from "react-native";
 
// global constants
export const colors = {
    red: '#df3f3f',
}
 
export const API_URL = 'https://app.clicknpush.ca'; // www has to be here for some reason. only on mobile app
 
export const Icons: {[key: number]: ImageURISource} = {
    1: require('../assets/pothole.png'),
    2: require('../assets/roadblock.png'),
    3: require('../assets/barrier.png'),
    4: require('../assets/bump.png'),
    5: require('../assets/information.png'),
    6: require('../assets/washroom.png'),
    7: require('../assets/park.png'),
} 
 
/**
 * Array that maps {@linkcode landmark_type} from {@link Landmark} to a string representing that landmark type.
 */
 export const IconStrings: string[] = ['', 'pothole', 'roadblock', 'barrier', 'bump', 'information', 'washroom', 'power'];
 
export const reportAxiosError = (desc: string,  error: AxiosError, printResponse?: boolean) => {
    let errorString = `XHR error: ${desc}\nError code: ${error.response?.status}\nError message: ${error.message}`;
 
    if (printResponse) {
        errorString + "\nError response: " + error.response;
    }
 
    console.error(errorString);
}