Axios add, url handling, sub url
This commit is contained in:
@@ -1,8 +0,0 @@
|
||||
VITE_APP_NAME=Kamera na OkU TT
|
||||
VITE_APP_ESP32_IP=172.16.3.139
|
||||
VITE_APP_ESP32_PREVIEW=http://172.16.3.139/cam-lo.jpg
|
||||
VITE_APP_ESP32_MJPEG=http://172.16.3.139/cam.mjpeg
|
||||
VITE_APP_SERVER=http://ttouli01.minv.sk/camera/
|
||||
VITE_APP_SEND_ONE=/send.one
|
||||
VITE_APP_SEND_ZERO=/send.zero
|
||||
VITE_APP_SEND_PULSE=/send.pulse
|
||||
@@ -10,6 +10,7 @@
|
||||
"dependencies": {
|
||||
"@vue/composition-api": "^1.2.4",
|
||||
"@vueuse/core": "^6.5.3",
|
||||
"axios": "^0.24.0",
|
||||
"core-js": "^3.18.3",
|
||||
"vue": "^2.6.14",
|
||||
"vue-demi": "^0.11.4",
|
||||
|
||||
@@ -45,6 +45,7 @@ import { computed, defineComponent } from "vue-demi";
|
||||
import { routes } from "@/router";
|
||||
import { useDark, useToggle } from "@vueuse/core";
|
||||
import logoUrl from '@/assets/mvsr-logo.png';
|
||||
import axios from 'axios';
|
||||
|
||||
export default defineComponent({
|
||||
setup: (_, ctx) => {
|
||||
@@ -52,12 +53,17 @@ export default defineComponent({
|
||||
const appName = import.meta.env.VITE_APP_NAME;
|
||||
const urlMjpeg = import.meta.env.VITE_APP_ESP32_MJPEG;
|
||||
const previewUrl = import.meta.env.VITE_APP_ESP32_PREVIEW;
|
||||
const esp32ip = import.meta.env.VITE_APP_ESP32_IP;
|
||||
const oneurl = import.meta.env.VITE_APP_SEND_ONE;
|
||||
const zerourl = import.meta.env.VITE_APP_SEND_ZERO;
|
||||
const pulseurl = import.meta.env.VITE_APP_SEND_PULSE;
|
||||
|
||||
var clickMJ = 0;
|
||||
var clickPW = 0;
|
||||
var previewSrc = [ logoUrl, previewUrl];
|
||||
var mjpegSrc = [ urlMjpeg, logoUrl];
|
||||
|
||||
return { appName, previewSrc, mjpegSrc, clickMJ, clickPW };
|
||||
return { appName, previewSrc, mjpegSrc, clickMJ, clickPW, esp32ip, oneurl, zerourl, pulseurl };
|
||||
},
|
||||
methods: {
|
||||
clickPreview() {
|
||||
@@ -77,11 +83,40 @@ export default defineComponent({
|
||||
},
|
||||
openDoor() {
|
||||
console.log('Open Door');
|
||||
axios.get(esp32ip + oneurl)
|
||||
.then(response => {
|
||||
//
|
||||
//this.result = response.data;
|
||||
console.log('DATA = ',response.data);
|
||||
})
|
||||
.catch(e => {
|
||||
this.errors.push(e)
|
||||
})
|
||||
},
|
||||
closeDoor() {
|
||||
console.log('Close Door');
|
||||
axios.get(esp32ip + zerourl)
|
||||
.then(response => {
|
||||
//
|
||||
//this.result = response.data;
|
||||
console.log('DATA = ',response.data);
|
||||
})
|
||||
.catch(e => {
|
||||
this.errors.push(e)
|
||||
})
|
||||
|
||||
},
|
||||
pulseDoor() {
|
||||
axios.get(esp32ip + pulseurl)
|
||||
.then(response => {
|
||||
//
|
||||
//this.result = response.data;
|
||||
console.log('DATA = ',response.data);
|
||||
})
|
||||
.catch(e => {
|
||||
this.errors.push(e)
|
||||
})
|
||||
|
||||
console.log('Send pulse to Door');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,7 +29,7 @@ export const routes: RouteConfig[] = [
|
||||
];
|
||||
|
||||
const router = new VueRouter({
|
||||
base: "/",
|
||||
base: "/camera/",
|
||||
mode: "history",
|
||||
routes,
|
||||
});
|
||||
|
||||
@@ -13,6 +13,7 @@ const config = defineConfig({
|
||||
},
|
||||
dedupe: ["vue-demi"],
|
||||
},
|
||||
base: "./",
|
||||
|
||||
build: {
|
||||
minify: true,
|
||||
|
||||
12
yarn.lock
12
yarn.lock
@@ -685,6 +685,13 @@ at-least-node@^1.0.0:
|
||||
resolved "https://registry.yarnpkg.com/at-least-node/-/at-least-node-1.0.0.tgz#602cd4b46e844ad4effc92a8011a3c46e0238dc2"
|
||||
integrity sha512-+q/t7Ekv1EDY2l6Gda6LLiX14rU9TV20Wa3ofeQmwPFZbOMo9DXrLbOjFaaclkXKWidIaopwAObQDqwWtGUjqg==
|
||||
|
||||
axios@^0.24.0:
|
||||
version "0.24.0"
|
||||
resolved "https://registry.yarnpkg.com/axios/-/axios-0.24.0.tgz#804e6fa1e4b9c5288501dd9dff56a7a0940d20d6"
|
||||
integrity sha512-Q6cWsys88HoPgAaFAVUb0WpPk0O8iTeisR9IMqy9G8AbO4NlpVknrnQS03zzF9PGAWgO3cgletO3VjV/P7VztA==
|
||||
dependencies:
|
||||
follow-redirects "^1.14.4"
|
||||
|
||||
babel-code-frame@^6.26.0:
|
||||
version "6.26.0"
|
||||
resolved "https://registry.yarnpkg.com/babel-code-frame/-/babel-code-frame-6.26.0.tgz#63fd43f7dc1e3bb7ce35947db8fe369a3f58c74b"
|
||||
@@ -1755,6 +1762,11 @@ flatted@^3.1.0:
|
||||
resolved "https://registry.yarnpkg.com/flatted/-/flatted-3.2.2.tgz#64bfed5cb68fe3ca78b3eb214ad97b63bedce561"
|
||||
integrity sha512-JaTY/wtrcSyvXJl4IMFHPKyFur1sE9AUqc0QnhOaJ0CxHtAoIV8pYDzeEfAaNEtGkOfq4gr3LBFmdXW5mOQFnA==
|
||||
|
||||
follow-redirects@^1.14.4:
|
||||
version "1.14.5"
|
||||
resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.14.5.tgz#f09a5848981d3c772b5392309778523f8d85c381"
|
||||
integrity sha512-wtphSXy7d4/OR+MvIFbCVBDzZ5520qV8XfPklSN5QtxuMUJZ+b0Wnst1e1lCDocfzuCkHqj8k0FpZqO+UIaKNA==
|
||||
|
||||
fs-extra@^9.1.0:
|
||||
version "9.1.0"
|
||||
resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-9.1.0.tgz#5954460c764a8da2094ba3554bf839e6b9a7c86d"
|
||||
|
||||
Reference in New Issue
Block a user