Plop user data into the store when loading up the base component
This commit is contained in:
parent
328347fab7
commit
e20a768182
5 changed files with 87 additions and 28 deletions
14
resources/scripts/state/models/flashes.ts
Normal file
14
resources/scripts/state/models/flashes.ts
Normal file
|
@ -0,0 +1,14 @@
|
|||
import { action } from 'easy-peasy';
|
||||
import { FlashState } from '@/state/types';
|
||||
|
||||
const flashes: FlashState = {
|
||||
items: [],
|
||||
addFlash: action((state, payload) => {
|
||||
state.items.push(payload);
|
||||
}),
|
||||
clearFlashes: action(state => {
|
||||
state.items = [];
|
||||
}),
|
||||
};
|
||||
|
||||
export default flashes;
|
11
resources/scripts/state/models/user.ts
Normal file
11
resources/scripts/state/models/user.ts
Normal file
|
@ -0,0 +1,11 @@
|
|||
import { UserState } from '@/state/types';
|
||||
import { action } from 'easy-peasy';
|
||||
|
||||
const user: UserState = {
|
||||
data: undefined,
|
||||
setUserData: action((state, payload) => {
|
||||
state.data = payload;
|
||||
}),
|
||||
};
|
||||
|
||||
export default user;
|
Loading…
Add table
Add a link
Reference in a new issue