New-site/resources/stores/schedule.js
Dhaverd 35a93c343e
Some checks failed
Gitea Actions / Build and deploy (push) Has been cancelled
Перенес запросы на бэк из basya в стор pinia
2024-04-20 16:12:45 +08:00

38 lines
890 B
JavaScript

import {defineStore} from "pinia";
import axios from "axios";
export const useScheduleStore = defineStore('schedule', {
state: () => ({
dates: Object,
links: Object,
schedules: Object
}),
getters: {
},
actions: {
async getDates(){
await axios
.get('/api/v1/dates')
.then((response) => {
this.dates = response.data;
});
},
async getLinks(){
await axios
.get('/api/v1/links')
.then((response)=>{
this.links = response.data;
})
},
async getSchedules(){
await axios
.get('/api/v1/schedules')
.then((response)=>{
this.schedules = response.data;
})
}
},
})