Compare commits
No commits in common. "facd8d912ffec8e804a004fb4cb6de8a58ea3cdb" and "ace77028c45c74782b13cd3ffe378ba0fda678f5" have entirely different histories.
facd8d912f
...
ace77028c4
|
@ -7,7 +7,6 @@
|
|||
"@testing-library/jest-dom": "^4.2.4",
|
||||
"@testing-library/react": "^9.3.2",
|
||||
"@testing-library/user-event": "^7.1.2",
|
||||
"axios": "^0.21.1",
|
||||
"grommet": "^2.16.2",
|
||||
"grommet-icons": "^4.5.0",
|
||||
"polished": "^4.0.5",
|
||||
|
|
|
@ -3,17 +3,7 @@ import PropTypes from "prop-types";
|
|||
import { Box, Button, Heading, Text } from "grommet";
|
||||
import { Aid, Impact } from "grommet-icons";
|
||||
|
||||
import Telegram from "../utils/telegram";
|
||||
import { TG_API, TG_USERID } from "../config";
|
||||
|
||||
function sendNotification(close) {
|
||||
const bot = new Telegram(TG_API);
|
||||
bot.sendMessage(TG_USERID, "User detected in an accident. Location has been attached below.");
|
||||
navigator.geolocation.getCurrentPosition(
|
||||
position => bot.sendLocation( TG_USERID,
|
||||
position.coords.latitude, position.coords.longitude),
|
||||
() => bot.sendMessage(TG_USERID, "Error retrieving location")
|
||||
);
|
||||
setTimeout(close, 2000);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
const WS_BASE = "http://localhost:5050/";
|
||||
const TG_API = "xxxxxxxxx:xxxxxxxxxxxxxxxxxxxxxx";
|
||||
const TG_USERID = 123456789;
|
||||
|
||||
export { WS_BASE, TG_API, TG_USERID };
|
||||
export { WS_BASE };
|
||||
|
|
|
@ -1,19 +0,0 @@
|
|||
import axios from "axios";
|
||||
|
||||
class Telegram {
|
||||
constructor(token) {
|
||||
this.axios = axios.create({
|
||||
baseURL: `https://api.telegram.org/bot${token}`
|
||||
});
|
||||
}
|
||||
|
||||
sendMessage(chat_id, text) {
|
||||
this.axios.post("/sendMessage", {chat_id, text});
|
||||
}
|
||||
|
||||
sendLocation(chat_id, latitude, longitude) {
|
||||
this.axios.post("/sendLocation", {chat_id, latitude, longitude});
|
||||
}
|
||||
}
|
||||
|
||||
export default Telegram;
|
|
@ -2590,13 +2590,6 @@ axe-core@^4.0.2:
|
|||
resolved "https://registry.npmjs.org/axe-core/-/axe-core-4.1.1.tgz#70a7855888e287f7add66002211a423937063eaf"
|
||||
integrity sha512-5Kgy8Cz6LPC9DJcNb3yjAXTu3XihQgEdnIg50c//zOC/MyLP0Clg+Y8Sh9ZjjnvBrDZU4DgXS9C3T9r4/scGZQ==
|
||||
|
||||
axios@^0.21.1:
|
||||
version "0.21.1"
|
||||
resolved "https://registry.npmjs.org/axios/-/axios-0.21.1.tgz#22563481962f4d6bde9a76d516ef0e5d3c09b2b8"
|
||||
integrity sha512-dKQiRHxGD9PPRIUNIWvZhPTPpl1rf/OxTYKsqKUDjBwYylTvV7SjSHJb9ratfyzM6wCdLCOYLzs73qpg5c4iGA==
|
||||
dependencies:
|
||||
follow-redirects "^1.10.0"
|
||||
|
||||
axobject-query@^2.2.0:
|
||||
version "2.2.0"
|
||||
resolved "https://registry.npmjs.org/axobject-query/-/axobject-query-2.2.0.tgz#943d47e10c0b704aa42275e20edf3722648989be"
|
||||
|
@ -5211,7 +5204,7 @@ flush-write-stream@^1.0.0:
|
|||
inherits "^2.0.3"
|
||||
readable-stream "^2.3.6"
|
||||
|
||||
follow-redirects@^1.0.0, follow-redirects@^1.10.0:
|
||||
follow-redirects@^1.0.0:
|
||||
version "1.13.1"
|
||||
resolved "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.13.1.tgz#5f69b813376cee4fd0474a3aba835df04ab763b7"
|
||||
integrity sha512-SSG5xmZh1mkPGyKzjZP8zLjltIfpW32Y5QpdNJyjcfGxK3qo3NDDkZOZSFiGn1A6SclQxY9GzEwAHQ3dmYRWpg==
|
||||
|
|
Loading…
Reference in New Issue