upd: vue.emergency (now send with api)
This commit is contained in:
parent
ab1b3080c7
commit
b7d22fad31
|
@ -24,7 +24,10 @@
|
|||
<script>
|
||||
export default {
|
||||
name: 'CONTAINER_EMERGENCY',
|
||||
data(){ return { gstore: gstore.data }; },
|
||||
data(){ return {
|
||||
gstore: gstore.data,
|
||||
dep: "31"
|
||||
}; },
|
||||
methods: {
|
||||
local_date: function(id){
|
||||
/* (1) Get current date */
|
||||
|
@ -49,14 +52,27 @@ export default {
|
|||
if( msg.trim().length == 0 )
|
||||
return;
|
||||
|
||||
/* (2) Send message to WebSocket */
|
||||
wsc_emergency.send(JSON.stringify({message: msg, location: [1.1, 2.2]}));
|
||||
/* (2) Prepare request */
|
||||
var rq = {
|
||||
message: this.gstore.new_msg.emergency,
|
||||
location: [1.1, 2.2],
|
||||
username: this.gstore.server.session.name
|
||||
};
|
||||
|
||||
/* (3) Add loader */
|
||||
gstore.data.msg_pending.emergency = true;
|
||||
|
||||
/* (4) Empty input */
|
||||
this.gstore.new_msg.emergency = '';
|
||||
/* (4) Send request */
|
||||
api.call("POST message/emergency/"+this.dep, rq, function(rs){
|
||||
|
||||
// {1} If error -> exit //
|
||||
if( rs.error != 0 )
|
||||
return;
|
||||
|
||||
// {2} Empty input //
|
||||
gstore.data.new_msg.emergency = '';
|
||||
|
||||
});
|
||||
|
||||
},
|
||||
bbcode: function(msg){
|
||||
|
|
Loading…
Reference in New Issue