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
475 B
20 lines
475 B
import { IObservableArray, observable } from "mobx"; |
|
import { MessageProps } from "semantic-ui-react"; |
|
|
|
import { getRandomId } from "@common/utils"; |
|
|
|
export interface Message extends MessageProps { |
|
id: number; |
|
} |
|
|
|
export class UiStore { |
|
@observable |
|
messages: IObservableArray<Message> = observable.array(); |
|
|
|
addMessage(message: MessageProps) { |
|
this.messages.push(observable({ |
|
...message, |
|
id: getRandomId(), |
|
})); |
|
} |
|
}
|
|
|