Convert all of the login components into hook based ones

This commit is contained in:
Dane Everitt 2019-06-22 16:45:51 -07:00
parent aabf9b8a70
commit 328347fab7
No known key found for this signature in database
GPG key ID: EEA66103B3D71F53
20 changed files with 435 additions and 598 deletions

View file

@ -0,0 +1,16 @@
import { action, createStore } from 'easy-peasy';
import { ApplicationState } from '@/state/types';
const state: ApplicationState = {
flashes: {
items: [],
addFlash: action((state, payload) => {
state.items.push(payload);
}),
clearFlashes: action(state => {
state.items = [];
}),
},
};
export const store = createStore(state);

19
resources/scripts/state/types.d.ts vendored Normal file
View file

@ -0,0 +1,19 @@
import { FlashMessageType } from '@/components/MessageBox';
import { Action } from 'easy-peasy';
export interface ApplicationState {
flashes: FlashState;
}
export interface FlashState {
items: FlashMessage[];
addFlash: Action<FlashState, FlashMessage>;
clearFlashes: Action<FlashState>;
}
export interface FlashMessage {
id?: string;
type: FlashMessageType;
title?: string;
message: string;
}