Creation of PersonResource

This commit is contained in:
2022-01-26 12:52:15 +00:00
committed by Julien Fastré
parent 7513187a6d
commit 88d1fe24b4
40 changed files with 1426 additions and 39 deletions

View File

@@ -0,0 +1,44 @@
<template>
<ul class="list-suggest add-items" v-if="this.suggested.length > 0">
<li v-for="r in this.suggested" @click="setReferrer(r)"><span>{{ r.text }}</span></li>
</ul>
</template>
<script>
import {makeFetch} from 'ChillMainAssets/lib/api/apiMethods.js';
export default {
name: "SetReferrer",
props: {
suggested: {
type: Array,
required: false,
default: [],
},
periodId: {
type: Number,
required: true
}
},
emits: ['referrerSet'],
methods: {
setReferrer: function(ref) {
const url = `/api/1.0/person/accompanying-course/${this.periodId}.json`;
const body = { type: "accompanying_period", user: { id: ref.id, type: ref.type }};
return makeFetch('PATCH', url, body)
.then((response) => {
this.$emit('referrerSet', ref);
})
.catch((error) => {
throw error;
})
}
}
}
</script>
<style scoped>
</style>