diff --git a/assets/static/js/main.js b/assets/static/js/main.js index 2eb81fd..81475b1 100644 --- a/assets/static/js/main.js +++ b/assets/static/js/main.js @@ -43,7 +43,7 @@ async function newModule() { body: JSON.stringify({ID: moduleID, Body: body}) }).then(async res => { if (res.status === 200) { - window.location.href = '/modules/' + window.location.href = '/' return } alert((await res.json()).msg) @@ -57,7 +57,7 @@ async function reloadModule() { method: 'POST', }).then(async res => { if (res.status === 200) { - window.location.href = '/modules/' + window.location.href = '/' return } alert((await res.json()).msg) @@ -95,7 +95,7 @@ async function deleteModule(id) { method: 'DELETE', }).then(async res => { if (res.status === 200) { - window.location.href = '/modules/' + window.location.href = '/' return } alert((await res.json()).msg) diff --git a/internal/db/module.go b/internal/db/module.go index 95a98de..64fa62f 100644 --- a/internal/db/module.go +++ b/internal/db/module.go @@ -55,7 +55,7 @@ func (db *modules) List(ctx context.Context, opts GetModuleOptions) ([]*Module, var modules []*Module q := db.WithContext(ctx).SelectFrom("modules") if opts.EnabledOnly { - q.Where("enabled = TRUE") + q = q.Where("enabled = TRUE") } return modules, q.All(&modules) } diff --git a/internal/route/module.go b/internal/route/module.go index 8dce2e0..9326898 100644 --- a/internal/route/module.go +++ b/internal/route/module.go @@ -154,7 +154,7 @@ func (*ModulesHandler) Update(ctx context.Context, f form.UpdateModule) { ctx.ServerError() return } - + ctx.Success("success") }