All files / app/payment/storedInstrument ManageInstrumentsAlert.tsx

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 3944x   44x 44x           44x 4x   4x   4x 1x             3x 1x             2x             44x  
import React, { memo, FunctionComponent } from 'react';
 
import { TranslatedString } from '../../locale';
import { Alert, AlertType } from '../../ui/alert';
 
export interface ManageInstrumentsAlertProps {
    error: any; // TODO: Fix typing
}
 
const ManageInstrumentsAlert: FunctionComponent<ManageInstrumentsAlertProps> = ({
    error,
}) => {
    const { status } = error;
 
    if (status === 401) {
        return (
            <Alert type={ AlertType.Error }>
                <TranslatedString id="payment.instrument_manage_delete_auth_error" />
            </Alert>
        );
    }
 
    if (status >= 400 && status < 500) {
        return (
            <Alert type={ AlertType.Error }>
                <TranslatedString id="payment.instrument_manage_delete_client_error" />
            </Alert>
        );
    }
 
    return (
        <Alert type={ AlertType.Error }>
            <TranslatedString id="payment.instrument_manage_delete_server_error" />
        </Alert>
    );
};
 
export default memo(ManageInstrumentsAlert);