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)
|
let res = await API.createPlugin(pluginData)
|
||||||
console.log("RESP", res)
|
console.log("RESP", res)
|
||||||
// TODO_RIC
|
|
||||||
// let newPlugin = resp.plugins[0]
|
let newPlugin = res.plugins[0]
|
||||||
// update(state => {
|
update(state => {
|
||||||
// const currentIdx = state.findIndex(plugin => plugin._id === newPlugin._id)
|
const currentIdx = state.findIndex(plugin => plugin._id === newPlugin._id)
|
||||||
// if (currentIdx >= 0) {
|
if (currentIdx >= 0) {
|
||||||
// state.splice(currentIdx, 1, newPlugin)
|
state.splice(currentIdx, 1, newPlugin)
|
||||||
// } else {
|
} else {
|
||||||
// state.push(newPlugin)
|
state.push(newPlugin)
|
||||||
// }
|
}
|
||||||
// return state
|
return state
|
||||||
// })
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
async function uploadPlugin(file, source) {
|
async function uploadPlugin(file, source) {
|
||||||
|
|
|
@ -72,11 +72,11 @@ export async function create(ctx: any) {
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const doc = storePlugin(metadata, directory, source)
|
const doc = await storePlugin(metadata, directory, source)
|
||||||
|
|
||||||
ctx.body = {
|
ctx.body = {
|
||||||
message: "Plugin uploaded successfully",
|
message: "Plugin uploaded successfully",
|
||||||
plugins: doc,
|
plugins: [doc],
|
||||||
}
|
}
|
||||||
} catch (err: any) {
|
} catch (err: any) {
|
||||||
const errMsg = err?.message ? err?.message : err
|
const errMsg = err?.message ? err?.message : err
|
||||||
|
|
Loading…
Reference in New Issue