Merge branch 'feat/add-common-service-and-class' into feat/add-user-service

This commit is contained in:
2023-09-28 21:56:04 +07:00
15 changed files with 2817 additions and 181 deletions
+3
View File
@@ -0,0 +1,3 @@
!.*.js
**/dist/**
**/coverage/**
+14
View File
@@ -0,0 +1,14 @@
module.exports = {
root: true,
plugins: ['@typescript-eslint', 'import', 'prettier'],
extends: [
'airbnb-typescript/base',
'prettier',
'plugin:@typescript-eslint/recommended',
'plugin:import/typescript',
],
parser: '@typescript-eslint/parser',
parserOptions: {
project: './tsconfig.eslint.json',
},
};
-56
View File
@@ -1,56 +0,0 @@
{
"root": true,
"parser": "@typescript-eslint/parser",
"extends": [
"airbnb-base",
"plugin:node/recommended",
"prettier",
"plugin:@typescript-eslint/recommended"
],
"plugins": ["@typescript-eslint", "prettier"],
"rules": {
"import/no-unresolved": "error",
"prettier/prettier": [
"error",
{
"endOfLine": "auto",
"semi": true
}
],
"no-unused-vars": "warn",
"no-console": "off",
"func-names": "off",
"no-process-exit": "off",
"object-shorthand": "off",
"class-methods-use-this": "off",
"no-shadow": "off",
"node/no-unsupported-features/es-syntax": [
"error",
{ "ignores": ["modules"] }
],
"import/extensions": [
"error",
"ignorePackages",
{
"js": "never",
"mjs": "never",
"ts": "never"
}
]
},
"settings": {
"import/parsers": {
"@typescript-eslint/parser": [".ts", ".tsx"]
},
"import/resolver": {
"node": {
"extensions": [".js", ".ts", ".json"]
}
},
"import/extensions": {
"typescript": {
"alwaysTryTypes": true // always try to resolve types under
}
}
}
}
+4
View File
@@ -0,0 +1,4 @@
!.*.js
**/dist/**
**/coverage/**
**/package-lock.json
+2765 -100
View File
File diff suppressed because it is too large Load Diff
+1 -4
View File
@@ -19,14 +19,11 @@
"@typescript-eslint/parser": "^6.7.3",
"eslint": "^8.50.0",
"eslint-config-airbnb-base": "^15.0.0",
"eslint-config-node": "^4.1.0",
"eslint-config-airbnb-typescript": "^17.1.0",
"eslint-config-prettier": "^9.0.0",
"eslint-import-resolver-typescript": "^3.6.1",
"eslint-plugin-import": "^2.28.1",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-prettier": "^5.0.0",
"prettier": "^3.0.3",
"prettier-eslint-cli": "^7.1.0",
"typescript": "^5.2.2"
}
}
@@ -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);
+4
View File
@@ -0,0 +1,4 @@
{
"extends": "./tsconfig.json",
"include": ["./**/*.ts", "./**/*.js", "./.*.js"]
}
+4
View File
@@ -8,6 +8,10 @@
"dom.iterable",
"scripthost"
] /* Specify a set of bundled library declaration files that describe the target runtime environment. */,
"baseUrl": "./",
"paths": {
"*": ["./src/ts/*"]
},
"experimentalDecorators": true /* Enable experimental support for legacy experimental decorators. */,
/* Modules */
"module": "commonjs" /* Specify what module code is generated. */,