42 lines
801 B
JavaScript
42 lines
801 B
JavaScript
import Server from '@/services/Server'
|
|
import { reactive } from 'vue';
|
|
|
|
import { GetCampaign } from "./Dragonroll";
|
|
import { socket } from './Socket';
|
|
|
|
let data = reactive({});
|
|
|
|
function InitData(){
|
|
data.value = {
|
|
concepts: [],
|
|
};
|
|
}
|
|
|
|
function FetchConcepts(){
|
|
Server().get('/concept/list?campaign=' + GetCampaign()._id).then(response => {
|
|
data.value.concepts = response.data.data;
|
|
}).catch((err) => console.log(err));
|
|
}
|
|
|
|
function FetchData(){
|
|
FetchConcepts();
|
|
}
|
|
|
|
|
|
socket.on('update-concepts', () => {
|
|
FetchConcepts();
|
|
});
|
|
|
|
let GetConcepts = () => data.value.concepts;
|
|
let GetConcept = (id) => Server().get('/concept/get?campaign=' + GetCampaign()._id + "&id=" + id)
|
|
|
|
|
|
export {
|
|
InitData,
|
|
FetchData,
|
|
|
|
FetchConcepts,
|
|
|
|
GetConcepts,
|
|
GetConcept,
|
|
} |