Skip to content

Commit

Permalink
feat: resend message
Browse files Browse the repository at this point in the history
  • Loading branch information
popstas committed Jun 27, 2018
1 parent 5ea37f5 commit f30b25d
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 2 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
- Вывод кнопок, отправка запросов с `type = 'ButtonPressed'`
- `session.session_id` хранится в sessionStorage
- `session.user_id` хранится в localStorage, то есть каждый браузер считается новым юзером
- Возможность переотправить выбранное сообщение

## Ограничения
- На данный момент можно привязать только один навык
Expand Down
17 changes: 17 additions & 0 deletions components/Message.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
<el-card :class="{ 'message': true, 'message_my': isMy }">
<div slot="header" class="clearfix">
{{ message.author }} <span class="message__date">{{ message.date }}</span>
<el-button v-if="isMy" title="resend" class="message__resend" icon="el-icon-refresh" @click="resend"></el-button>
</div>

<div class="message__text" v-html="text"></div>
Expand Down Expand Up @@ -43,9 +44,17 @@
}
&__date {
margin-left: 10px;
font-size: 0.8rem;
}
&__resend{
margin-left: 10px;
background: none;
border: none;
padding: 0;
}
&__button{
margin: 3px !important;
padding: 3px 6px !important;
Expand Down Expand Up @@ -88,6 +97,14 @@ export default {
url: button.url,
hide: button.hide
});
},
resend(){
this.$store.commit(ADD_MESSAGE, {
text: this.message.text,
author: AUTHOR_NAME
});
this.$store.dispatch(ALICE_REQUEST, this.message.text);
}
}
};
Expand Down
2 changes: 0 additions & 2 deletions store/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import pjson from '~/package.json';
import { isString } from 'util';

export const SET_ANSWERS = 'SET_ANSWERS';
export const ALICE_REQUEST = 'ALICE_REQUEST';
Expand Down Expand Up @@ -41,7 +40,6 @@ export const mutations = {
},

[ADD_MESSAGE](state, message) {

message = {
...message,
...{
Expand Down

0 comments on commit f30b25d

Please sign in to comment.