You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
20 lines
463 B
20 lines
463 B
7 years ago
|
import { IObservableArray, observable } from "mobx";
|
||
|
import { MessageProps } from "semantic-ui-react";
|
||
7 years ago
|
|
||
7 years ago
|
import { getRandomId } from "@common/utils";
|
||
8 years ago
|
|
||
7 years ago
|
export interface UiMessage extends MessageProps {
|
||
7 years ago
|
id: number;
|
||
8 years ago
|
}
|
||
|
|
||
|
export class UiStore {
|
||
7 years ago
|
messages: IObservableArray<UiMessage> = observable.array();
|
||
8 years ago
|
|
||
7 years ago
|
addMessage(message: MessageProps) {
|
||
|
this.messages.push(observable({
|
||
|
...message,
|
||
|
id: getRandomId(),
|
||
|
}));
|
||
8 years ago
|
}
|
||
|
}
|