This commit is contained in:
parent
d36555d0e4
commit
78f06a3046
Binary file not shown.
Before Width: | Height: | Size: 4.2 KiB After Width: | Height: | Size: 15 KiB |
@ -1,22 +1,31 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import axios from "axios";
|
import { defineComponent } from "vue";
|
||||||
|
import HHVDataService from "@/services/HHVDataService";
|
||||||
|
import type HHV from "@/types/HHV";
|
||||||
|
import type ResponseData from "@/types/ResponseData";
|
||||||
|
|
||||||
export default {
|
export default defineComponent({
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
weeknumber: 0,
|
weeknumber: {} as HHV,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
methods: {
|
||||||
async created() {
|
retrieveWeekNumber() {
|
||||||
try {
|
HHVDataService.getWeekNumber()
|
||||||
const res = await axios.get("https://hanyadikhetvan.tormakristof.eu/");
|
.then((response: ResponseData) => {
|
||||||
this.weeknumber = res.data;
|
this.weeknumber = response.data;
|
||||||
} catch (error) {
|
console.log(response.data);
|
||||||
console.log(error);
|
})
|
||||||
}
|
.catch((e: Error) => {
|
||||||
}
|
console.log(e);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
mounted() {
|
||||||
|
this.retrieveWeekNumber();
|
||||||
|
},
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
9
src/http-common.ts
Normal file
9
src/http-common.ts
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
import axios from "axios";
|
||||||
|
import type { AxiosInstance } from "axios";
|
||||||
|
|
||||||
|
const apiClient: AxiosInstance = axios.create({
|
||||||
|
baseURL: "https://hanyadikhetvan.tormakristof.eu",
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
export default apiClient;
|
10
src/services/HHVDataService.ts
Normal file
10
src/services/HHVDataService.ts
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
import http from "@/http-common";
|
||||||
|
|
||||||
|
/* eslint-disable */
|
||||||
|
class HHVDataService {
|
||||||
|
getWeekNumber(): Promise<any> {
|
||||||
|
return http.get("/");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export default new HHVDataService();
|
3
src/types/HHV.ts
Normal file
3
src/types/HHV.ts
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
export default interface HHV {
|
||||||
|
id: number;
|
||||||
|
}
|
3
src/types/ResponseData.ts
Normal file
3
src/types/ResponseData.ts
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
export default interface ResponseData {
|
||||||
|
data: any;
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user