Skip to content

Commit

Permalink
fix: query enabled modules
Browse files Browse the repository at this point in the history
  • Loading branch information
wuhan005 committed Dec 24, 2021
1 parent f775662 commit 7b38d86
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions assets/static/js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
Expand Down Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion internal/db/module.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down
2 changes: 1 addition & 1 deletion internal/route/module.go
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ func (*ModulesHandler) Update(ctx context.Context, f form.UpdateModule) {
ctx.ServerError()
return
}

ctx.Success("success")
}

Expand Down

0 comments on commit 7b38d86

Please sign in to comment.