Fix code according to the comments

This commit is contained in:
2023-09-28 17:40:43 +07:00
parent f5f26f6d4d
commit 3478725597
7 changed files with 22 additions and 21 deletions
@@ -2,10 +2,10 @@ export const DATABASE_URL =
'https://javascript-training-81f7a-default-rtdb.asia-southeast1.firebasedatabase.app';
export const TIME_OUT_SEC = 3;
export enum BTN_CONTENT {
GOT_IT = 'Got it!',
OK = 'Ok',
}
export const BTN_CONTENT = {
GOT_IT: 'Got it!',
OK: 'Ok',
};
export const LOCAL_STORAGE = {
ACCESS_TOKEN: 'accessToken',
@@ -1,17 +1,7 @@
export const PASSWORD_NOT_MATCH = 'Password not match!';
export const PASSWORD_NOT_STRONG =
'Password must at least one uppercase, one lowercase letter, one number and one special character!';
export const ERROR_MESSAGE_DEFAULT = ['Something went wrong!'];
export const TIME_OUT_ERROR = 'Connection time out! Please try again!';
export const ERROR_CREDENTIAL = {
title: 'Error Credential',
message: 'Email or password not match! Please try again!',
};
export const DEFAULT_TITLE_ERROR_TOAST = 'Error';
export const USER_EXIST_ERROR = 'User is exists! Please try another email!';
@@ -25,7 +15,3 @@ export const ADD_TRANSACTION_SUCCESS = 'Add success!';
export const UPDATE_TRANSACTION_SUCCESS = 'Update success!';
export const REGISTER_SUCCESS = 'Register Success';
export const REQUIRED_MESSAGE = (field: string) => `The ${field} is required!`;
export const INVALID_EMAIL_FORMAT = `The email is not correct!`;
@@ -0,0 +1,13 @@
export const PASSWORD_NOT_MATCH = 'Password not match!';
export const PASSWORD_NOT_STRONG =
'Password must at least one uppercase, one lowercase letter, one number and one special character!';
export const ERROR_CREDENTIAL = {
title: 'Error Credential',
message: 'Email or password not match! Please try again!',
};
export const INVALID_EMAIL_FORMAT = `The email is not correct!`;
export const REQUIRED_MESSAGE = (field: string) => `The ${field} is required!`;
@@ -5,6 +5,7 @@ export interface IDataObject<T> {
export class DataObject<T> {
public id: string;
public data: T;
constructor(dataObject: IDataObject<T>) {
@@ -1,4 +1,4 @@
import { TIME_OUT_ERROR } from '../constants/message';
import { TIME_OUT_ERROR } from '../constants/messages/dialog';
import { TIME_OUT_SEC } from '../constants/config';
import FirebaseService from '../services/firebaseService';
@@ -1,3 +1,4 @@
// eslint-disable-next-line import/prefer-default-export
export const redirectToLoginPage = (): void => {
window.location.replace('/login');
};
@@ -1,5 +1,5 @@
import { REGEX } from '../constants/config';
import * as MESSAGE from '../constants/message';
import { REQUIRED_MESSAGE } from '../constants/messages/form';
/**
* Validate password
@@ -23,7 +23,7 @@ export const compare2Password = (
export const renderRequiredText = (field: string, element: Element): void => {
const markup: string = `
<p class="error-text">${MESSAGE.REQUIRED_MESSAGE(field)}</p>
<p class="error-text">${REQUIRED_MESSAGE(field)}</p>
`;
element.insertAdjacentHTML('afterend', markup);