mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2026-03-13 09:27:45 +00:00
error TS2345: Argument of type 'string' is not assignable to parameter of type '"pending" | "accepted" | "declined" | "tentative"'.
This commit is contained in:
@@ -71,4 +71,11 @@ export function isEventInputCalendarRange(
|
||||
return typeof toBeDetermined.is === "string" && toBeDetermined.is === "range";
|
||||
}
|
||||
|
||||
export enum AnswerStatus {
|
||||
ACCEPTED = "accepted",
|
||||
DECLINED = "declined",
|
||||
PENDING = "pending",
|
||||
TENTATIVE = "tentative",
|
||||
}
|
||||
|
||||
export {};
|
||||
|
||||
@@ -49,11 +49,7 @@
|
||||
|
||||
<script lang="ts">
|
||||
import { defineComponent, PropType } from "vue";
|
||||
|
||||
const ACCEPTED = "accepted";
|
||||
const DECLINED = "declined";
|
||||
const PENDING = "pending";
|
||||
const TENTATIVELY_ACCEPTED = "tentative";
|
||||
import { AnswerStatus } from "../../types";
|
||||
|
||||
const i18n = {
|
||||
messages: {
|
||||
@@ -76,32 +72,28 @@ export default defineComponent({
|
||||
props: {
|
||||
calendarId: { type: Number, required: true },
|
||||
status: {
|
||||
type: String as PropType<
|
||||
"accepted" | "declined" | "pending" | "tentative"
|
||||
>,
|
||||
type: String as PropType<AnswerStatus>,
|
||||
required: true,
|
||||
},
|
||||
},
|
||||
emits: {
|
||||
statusChanged(payload: "accepted" | "declined" | "pending" | "tentative") {
|
||||
return true;
|
||||
statusChanged(payload: AnswerStatus) {
|
||||
return payload;
|
||||
},
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
Statuses: {
|
||||
ACCEPTED,
|
||||
DECLINED,
|
||||
PENDING,
|
||||
TENTATIVELY_ACCEPTED,
|
||||
ACCEPTED: AnswerStatus.ACCEPTED,
|
||||
DECLINED: AnswerStatus.DECLINED,
|
||||
PENDING: AnswerStatus.PENDING,
|
||||
TENTATIVELY_ACCEPTED: AnswerStatus.TENTATIVE,
|
||||
},
|
||||
};
|
||||
},
|
||||
|
||||
methods: {
|
||||
changeStatus: function (
|
||||
newStatus: "accepted" | "declined" | "pending" | "tentative",
|
||||
) {
|
||||
console.log("changeStatus", newStatus);
|
||||
changeStatus: function (newStatus: AnswerStatus) {
|
||||
const url = `/api/1.0/calendar/calendar/${this.$props.calendarId}/answer/${newStatus}.json`;
|
||||
window
|
||||
.fetch(url, {
|
||||
@@ -112,7 +104,6 @@ export default defineComponent({
|
||||
console.error("could not confirm answer", newStatus);
|
||||
return;
|
||||
}
|
||||
console.log("answer sent", newStatus);
|
||||
this.$emit("statusChanged", newStatus);
|
||||
});
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user