Update dependencies, refactor authentication, and enhance UI components
- Upgraded @reduxjs/toolkit to version 2.9.0 and added new dependencies including @techniker-me/pcast-api and moment. - Refactored authentication logic and added middleware for improved request handling. - Introduced new UI components such as buttons, loaders, and forms, along with a theme system following SOLID principles. - Updated routing to include protected routes and improved the login form with better error handling. - Removed unused CSS and organized the project structure for better maintainability.
This commit is contained in:
6
src/services/UserDataStore/IUserDataStore.ts
Normal file
6
src/services/UserDataStore/IUserDataStore.ts
Normal file
@@ -0,0 +1,6 @@
|
||||
export default interface IUserDataStore {
|
||||
setItem(key: string, value: string): void;
|
||||
getItem(key: string): string | null;
|
||||
removeItem(key: string): void;
|
||||
clear(): void;
|
||||
}
|
||||
23
src/services/UserDataStore/IndexedDB.ts
Normal file
23
src/services/UserDataStore/IndexedDB.ts
Normal file
@@ -0,0 +1,23 @@
|
||||
import IUserDataStore from './IUserDataStore';
|
||||
|
||||
export class IndexedDB implements IUserDataStore {
|
||||
static isSupported(): boolean {
|
||||
return 'indexedDB' in window;
|
||||
}
|
||||
|
||||
public getItem(key: string): string | null {
|
||||
throw new Error('Not Implemented');
|
||||
}
|
||||
|
||||
public setItem(key: string, value: string): void {
|
||||
throw new Error('Not Implemented');
|
||||
}
|
||||
|
||||
public removeItem(key: string): void {
|
||||
throw new Error('Not Implemented');
|
||||
}
|
||||
|
||||
public clear(): void {
|
||||
throw new Error('Not Implemented');
|
||||
}
|
||||
}
|
||||
23
src/services/UserDataStore/LocalStorage.ts
Normal file
23
src/services/UserDataStore/LocalStorage.ts
Normal file
@@ -0,0 +1,23 @@
|
||||
import IUserDataStore from './IUserDataStore';
|
||||
|
||||
export class LocalStorage implements IUserDataStore {
|
||||
static isSupported(): boolean {
|
||||
return 'localStorage' in window;
|
||||
}
|
||||
|
||||
public getItem(key: string): string | null {
|
||||
throw new Error('Not Implemented');
|
||||
}
|
||||
|
||||
public setItem(key: string, value: string): void {
|
||||
throw new Error('Not Implemented');
|
||||
}
|
||||
|
||||
public removeItem(key: string): void {
|
||||
throw new Error('Not Implemented');
|
||||
}
|
||||
|
||||
public clear(): void {
|
||||
throw new Error('Not Implemented');
|
||||
}
|
||||
}
|
||||
23
src/services/UserDataStore/ObjectStore.ts
Normal file
23
src/services/UserDataStore/ObjectStore.ts
Normal file
@@ -0,0 +1,23 @@
|
||||
import IUserDataStore from './IUserDataStore';
|
||||
|
||||
export class ObjectStrore implements IUserDataStore {
|
||||
static isSupported(): boolean {
|
||||
return true;
|
||||
}
|
||||
|
||||
public getItem(key: string): string | null {
|
||||
throw new Error('Not Implemented');
|
||||
}
|
||||
|
||||
public setItem(key: string, value: string): void {
|
||||
throw new Error('Not Implemented');
|
||||
}
|
||||
|
||||
public removeItem(key: string): void {
|
||||
throw new Error('Not Implemented');
|
||||
}
|
||||
|
||||
public clear(): void {
|
||||
throw new Error('Not Implemented');
|
||||
}
|
||||
}
|
||||
24
src/services/UserDataStore/index.ts
Normal file
24
src/services/UserDataStore/index.ts
Normal file
@@ -0,0 +1,24 @@
|
||||
import IUserDataStore from './IUserDataStore';
|
||||
import {IndexedDB} from './IndexedDB';
|
||||
import {LocalStorage} from './LocalStorage';
|
||||
import {ObjectStrore} from './ObjectStore';
|
||||
|
||||
class UserDataStoreService {
|
||||
private static _instance: IUserDataStore;
|
||||
|
||||
static {
|
||||
if (IndexedDB.isSupported()) {
|
||||
this._instance = new IndexedDB();
|
||||
} else if (LocalStorage.isSupported()) {
|
||||
this._instance = new LocalStorage();
|
||||
} else {
|
||||
this._instance = new ObjectStrore();
|
||||
}
|
||||
}
|
||||
|
||||
public static getInstance(): IUserDataStore {
|
||||
return this._instance;
|
||||
}
|
||||
}
|
||||
|
||||
export default UserDataStoreService.getInstance();
|
||||
Reference in New Issue
Block a user