diff options
author | Santo Cariotti <santo@dcariotti.me> | 2022-09-19 21:02:33 +0200 |
---|---|---|
committer | Santo Cariotti <santo@dcariotti.me> | 2022-09-19 21:02:33 +0200 |
commit | 0a99b1d5da22b8fdec44d14b12377488091758f9 (patch) | |
tree | b761e0e9927eabff2152ffadb53fef153cbfc1fd /store/models.js | |
parent | 6657722d68169ada3f36fff9455413f9cc6d6c53 (diff) |
Model info page
Diffstat (limited to 'store/models.js')
-rw-r--r-- | store/models.js | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/store/models.js b/store/models.js index e2a0e30..23c612e 100644 --- a/store/models.js +++ b/store/models.js @@ -49,4 +49,27 @@ export const actions = { 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; + }, }; |