Compare commits

...

1 Commits

3 changed files with 21 additions and 6 deletions

View File

@ -60,4 +60,6 @@ delete window._router_;
/* (4) Get geolocation /* (4) Get geolocation
---------------------------------------------------------*/ ---------------------------------------------------------*/
navigator.geolocation && navigator.geolocation.getCurrentPosition(function(a, b){ console.log(this, a, b); }, null); navigator.geolocation && navigator.geolocation.getCurrentPosition(function(loc){
gstore.data.loc = [ loc.coords.latitude, loc.coords.longitude ];
}, null);

View File

@ -55,7 +55,7 @@ export default {
/* (2) Prepare request */ /* (2) Prepare request */
var rq = { var rq = {
message: this.gstore.new_msg.emergency, message: this.gstore.new_msg.emergency,
location: [1.1, 2.2], location: this.gstore.loc,
username: this.gstore.server.session.name username: this.gstore.server.session.name
}; };

View File

@ -49,14 +49,27 @@ export default {
if( msg.trim().length == 0 ) if( msg.trim().length == 0 )
return; return;
/* (2) Send message to WebSocket */ /* (2) Prepare request */
wsc_event.send(JSON.stringify({message: msg, location: [1.1, 2.2]})); var rq = {
message: this.gstore.new_msg.event,
location: this.gstore.loc,
username: this.gstore.server.session.name
};
/* (3) Add loader */ /* (3) Add loader */
gstore.data.msg_pending.event = true; gstore.data.msg_pending.event = true;
/* (4) Empty input */ /* (4) Send request */
this.gstore.new_msg.event = ''; api.call("POST message/event/"+this.dep, rq, function(rs){
// {1} If error -> exit //
if( rs.error != 0 )
return;
// {2} Empty input //
gstore.data.new_msg.event = '';
});
}, },
bbcode: function(msg){ bbcode: function(msg){