plugins npm and url working
This commit is contained in:
parent
ac33190ff0
commit
1c67772973
|
@ -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) {
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue