Skip to content
Snippets Groups Projects
Commit 92540df7 authored by Sirieam Marie Hunke's avatar Sirieam Marie Hunke Committed by Petar Hristov
Browse files

WIP

parent 508a79a2
No related branches found
No related tags found
2 merge requests!257Apiv2,!239Issue/2441 pid api improvements
...@@ -144,7 +144,7 @@ import usePidStore from "../store"; ...@@ -144,7 +144,7 @@ import usePidStore from "../store";
import useNotificationStore from "@/store/notification"; import useNotificationStore from "@/store/notification";
import { useVuelidate, type ValidationArgs } from "@vuelidate/core"; import { useVuelidate, type ValidationArgs } from "@vuelidate/core";
import { email, maxLength, required } from "@vuelidate/validators"; import { email, maxLength, required } from "@vuelidate/validators";
import type { MessageObject } from "@coscine/api-client/dist/types/Coscine.Api.Pid"; import type { PidEnquiryDto } from "@coscine/api-client/dist/types/Coscine.Api/api";
export default defineComponent({ export default defineComponent({
setup() { setup() {
...@@ -206,12 +206,6 @@ export default defineComponent({ ...@@ -206,12 +206,6 @@ export default defineComponent({
this.$root.$emit("bv::show::tooltip", "copyPidTooltip"); this.$root.$emit("bv::show::tooltip", "copyPidTooltip");
} }
}, },
getPidSuffix(): string {
if (this.pid && this.pid.lastIndexOf("/") !== -1) {
return this.pid.split("/")[1];
}
return "";
},
async validatePid(): Promise<boolean | null> { async validatePid(): Promise<boolean | null> {
if (this.pid) { if (this.pid) {
return await this.pidStore.isPidValid(this.pid); return await this.pidStore.isPidValid(this.pid);
...@@ -220,9 +214,10 @@ export default defineComponent({ ...@@ -220,9 +214,10 @@ export default defineComponent({
async clickSubmit() { async clickSubmit() {
if (this.pid && this.isPidValid && !this.v$.form.$invalid) { if (this.pid && this.isPidValid && !this.v$.form.$invalid) {
this.isLoading = true; this.isLoading = true;
this.form.pid = this.pid; const success = await this.pidStore.contactPidOwner(
this.form.guid = this.getPidSuffix(); this.pid,
const success = await this.pidStore.contactPidOwner(this.form); this.form
);
if (success) { if (success) {
// On Success // On Success
this.notificationStore.postNotification({ this.notificationStore.postNotification({
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment