From 0a99b1d5da22b8fdec44d14b12377488091758f9 Mon Sep 17 00:00:00 2001 From: Santo Cariotti Date: Mon, 19 Sep 2022 21:02:33 +0200 Subject: Model info page --- store/models.js | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'store') diff --git a/store/models.js b/store/models.js index e2a0e30..23c612e 100644 --- a/store/models.js +++ b/store/models.js @@ -47,6 +47,29 @@ export const actions = { commit("loadingStatus", false, { root: true }); + return res; + }, + // Find a model by its id + async findModal({ commit }, id) { + commit("loadingStatus", true, { root: true }); + let res = { status: 0, data: null }; + let api = this.$config.api; + + await fetch(`${api}/v1/models/${id}`, { + headers: { + "Content-Type": "application/json", + }, + }) + .then(async (response) => { + res.data = await response.json(); + res.status = response.status; + }) + .catch((e) => { + res.status = e.status; + }); + + commit("loadingStatus", false, { root: true }); + return res; }, }; -- cgit v1.2.3-18-g5258