plugins npm and url working

This commit is contained in:
NEOLPAR 2022-08-31 17:53:00 +01:00
parent ac33190ff0
commit 1c67772973
2 changed files with 13 additions and 13 deletions

View File

@ -36,17 +36,17 @@ export function createPluginsStore() {
let res = await API.createPlugin(pluginData)
console.log("RESP", res)
// TODO_RIC
// let newPlugin = resp.plugins[0]
// update(state => {
// const currentIdx = state.findIndex(plugin => plugin._id === newPlugin._id)
// if (currentIdx >= 0) {
// state.splice(currentIdx, 1, newPlugin)
// } else {
// state.push(newPlugin)
// }
// return state
// })
let newPlugin = res.plugins[0]
update(state => {
const currentIdx = state.findIndex(plugin => plugin._id === newPlugin._id)
if (currentIdx >= 0) {
state.splice(currentIdx, 1, newPlugin)
} else {
state.push(newPlugin)
}
return state
})
}
async function uploadPlugin(file, source) {

View File

@ -72,11 +72,11 @@ export async function create(ctx: any) {
}
try {
const doc = storePlugin(metadata, directory, source)
const doc = await storePlugin(metadata, directory, source)
ctx.body = {
message: "Plugin uploaded successfully",
plugins: doc,
plugins: [doc],
}
} catch (err: any) {
const errMsg = err?.message ? err?.message : err