mirror of
https://github.com/darksaid98/new-phone-who-dis.git
synced 2026-12-04 14:38:45 +00:00
refactor(server/notes): Implement singleton architecture
Also trying something out with the response structure on the server to cut down on redundant calls.
This commit is contained in:
1 parent
d93bdd20d8
commit
0bb20fff31
8 files changed
+219
-136
No files matched your search
+11
-4
@@ -1,3 +1,5 @@
|
||||
import { IAlertProps } from './alerts';
|
||||
|
||||
export type AlertCategory =
|
||||
| 'NOTES_ADD_SUCCESS'
|
||||
| 'NOTES_ADD_FAILED'
|
||||
@@ -17,10 +19,6 @@ export interface Note {
|
||||
content: string;
|
||||
}
|
||||
|
||||
export interface NoteId {
|
||||
id: number;
|
||||
}
|
||||
|
||||
export enum NotesEvents {
|
||||
ADD_NOTE = 'npwd:addNote',
|
||||
FETCH_ALL_NOTES = 'npwd:fetchAllNotes',
|
||||
@@ -33,4 +31,13 @@ export enum NotesEvents {
|
||||
UPDATE_NOTE_FAILURE = 'npwd:updateNoteFailure',
|
||||
ACTION_RESULT = 'npwd:notesActionResult',
|
||||
SEND_ALERT = 'npwd:notesSetAlert',
|
||||
SERVER_RESP = 'npwd:notesServerResp',
|
||||
}
|
||||
|
||||
export interface NoteServerResponse<T = unknown> {
|
||||
alert?: IAlertProps;
|
||||
action: 'SEND' | 'UPDATE' | 'DELETE' | 'ADD';
|
||||
suceeded: boolean;
|
||||
refetch?: boolean;
|
||||
data?: T;
|
||||
}
|
||||
Reference in new issue
Block a user