@@ -35,6 +39,7 @@ import Spinner from "@/components/Spinner.vue";
import SuccessCheckmark from "@/components/SuccessCheckmark.vue";
import FailureXMark from "@/components/FailureXMark.vue";
import { useWebapiStore } from "@/stores/admin/user/webapi";
+import type { CreateWebapiViewModel } from "../../../../viewmodels/admin/user/webapi.models";
+
+
diff --git a/src/stores/admin/user/webapi.ts b/src/stores/admin/user/webapi.ts
index 4ddf939..66a57e7 100644
--- a/src/stores/admin/user/webapi.ts
+++ b/src/stores/admin/user/webapi.ts
@@ -1,5 +1,9 @@
import { defineStore } from "pinia";
-import type { WebapiViewModel } from "@/viewmodels/admin/user/webapi.models";
+import type {
+ CreateWebapiViewModel,
+ UpdateWebapiViewModel,
+ WebapiViewModel,
+} from "@/viewmodels/admin/user/webapi.models";
import { http } from "@/serverCom";
import type { PermissionObject } from "@/types/permissionTypes";
import type { AxiosResponse } from "axios";
@@ -27,17 +31,16 @@ export const useWebapiStore = defineStore("webapi", {
fetchWebapiById(id: number): Promise
> {
return http.get(`/admin/webapi/${id}`);
},
- async createWebapi(webapi: string): Promise> {
- const result = await http.post("/admin/webapi", {
- webapi: webapi,
- });
+ fetchWebapiTokenById(id: number): Promise> {
+ return http.get(`/admin/webapi/${id}/token`);
+ },
+ async createWebapi(webapi: CreateWebapiViewModel): Promise> {
+ const result = await http.post("/admin/webapi", webapi);
this.fetchWebapis();
return result;
},
- async updateActiveWebapi(id: number, webapi: string): Promise> {
- const result = await http.patch(`/admin/webapi/${id}`, {
- webapi: webapi,
- });
+ async updateActiveWebapi(id: number, webapi: UpdateWebapiViewModel): Promise> {
+ const result = await http.patch(`/admin/webapi/${id}`, webapi);
this.fetchWebapis();
return result;
},
diff --git a/src/viewmodels/admin/user/webapi.models.ts b/src/viewmodels/admin/user/webapi.models.ts
index 1bdf93c..015837c 100644
--- a/src/viewmodels/admin/user/webapi.models.ts
+++ b/src/viewmodels/admin/user/webapi.models.ts
@@ -11,16 +11,10 @@ export interface WebapiViewModel {
export interface CreateWebapiViewModel {
title: string;
- token: string;
expiry?: Date;
}
export interface UpdateWebapiViewModel {
- id: number;
title: string;
expiry?: Date;
}
-
-export interface DeleteWebapiViewModel {
- id: number;
-}
diff --git a/src/views/admin/user/webapi/WebapiEdit.vue b/src/views/admin/user/webapi/WebapiEdit.vue
index 7c17d94..8eb85f7 100644
--- a/src/views/admin/user/webapi/WebapiEdit.vue
+++ b/src/views/admin/user/webapi/WebapiEdit.vue
@@ -17,8 +17,12 @@
@submit.prevent="triggerWebapiUpdate"
>
-
-
+
+
+
+
+
+