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);
}
Source