diff --git a/README.MD b/README.MD
deleted file mode 100644
index 12e2d47..0000000
--- a/README.MD
+++ /dev/null
@@ -1 +0,0 @@
-typescript-training
diff --git a/typescript-practice/src/pages/index.html b/typescript-practice/src/pages/index.html
index 3ddbe41..1e0e9c1 100644
--- a/typescript-practice/src/pages/index.html
+++ b/typescript-practice/src/pages/index.html
@@ -1,4 +1,4 @@
-
+
diff --git a/typescript-practice/src/ts/constants/config.ts b/typescript-practice/src/ts/constants/config.ts
new file mode 100644
index 0000000..9a030a0
--- /dev/null
+++ b/typescript-practice/src/ts/constants/config.ts
@@ -0,0 +1,28 @@
+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 LOCAL_STORAGE = {
+ ACCESS_TOKEN: 'accessToken',
+};
+
+export enum TYPE_TOAST {
+ success = 'success',
+ error = 'error',
+}
+export enum MARK_ICON {
+ success = 'check',
+ error = 'error',
+}
+
+export const REGEX = {
+ PASSWORD:
+ /^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[@$!%*?&])[A-Za-z\d@$!%*?&]{8,}$/,
+ EMAIL:
+ /^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|.(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,
+};
diff --git a/typescript-practice/src/ts/constants/message.ts b/typescript-practice/src/ts/constants/message.ts
new file mode 100644
index 0000000..6a4bad3
--- /dev/null
+++ b/typescript-practice/src/ts/constants/message.ts
@@ -0,0 +1,31 @@
+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!';
+
+export const ADD_WALLET_SUCCESS = 'Add wallet success!';
+
+export const DEFAULT_MESSAGE = 'Press OK to continue!';
+
+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) => `The ${field} is required!`;
+
+export const INVALID_EMAIL_FORMAT = `The email is not correct!`;
diff --git a/typescript-practice/src/ts/helpers/helpers.ts b/typescript-practice/src/ts/helpers/helpers.ts
new file mode 100644
index 0000000..278e65d
--- /dev/null
+++ b/typescript-practice/src/ts/helpers/helpers.ts
@@ -0,0 +1,69 @@
+import * as MESSAGE from '../constants/message';
+import { TIME_OUT_SEC, REGEX } from '../constants/config';
+import FirebaseService from '../services/firebaseService';
+
+/**
+ * Validate password
+ * @param {string} password Password input
+ * @returns {boolean} Return true if validate password success, otherwise return false
+ */
+export const isValidPassword = (password: string): boolean => {
+ return REGEX.PASSWORD.test(password);
+};
+
+export const isValidateEmail = (email: string): RegExpMatchArray | null => {
+ return String(email).toLowerCase().match(REGEX.EMAIL);
+};
+
+export const compare2Password = (
+ password: string,
+ passwordConfirm: string,
+): boolean => {
+ return password === passwordConfirm;
+};
+
+/**
+ * A waiting function with s second
+ * @param {number} s The time will be waiting
+ * @returns {Promise} A Promise will be only reject after s second
+ */
+export const timeout = (s: number): Promise => {
+ return new Promise((_, reject) => {
+ setTimeout(() => {
+ FirebaseService.disconnect();
+ reject(MESSAGE.TIME_OUT_ERROR);
+ }, s * 1000);
+ });
+};
+
+export const createIdUser = (): number => {
+ return new Date().getTime();
+};
+
+/**
+ * A function waiting the action need to be perform and throw error after s second.
+ * @param {Function} action The action need to be perform.
+ * @returns { Object || Error } Return the any object from Firebase or Error
+ */
+export const timeOutConnect = async (
+ action: Promise