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