Fixed loopAll() async errors
This commit is contained in:
@@ -19,8 +19,8 @@ export const loadAllOptions = async () => {
|
||||
//update options on config reload
|
||||
optionConfig.onReload(async () => {
|
||||
//clear previous options & suffixes
|
||||
openticket.options.forEach((data,id) => {openticket.options.remove(id)})
|
||||
openticket.options.suffix.forEach((data,id) => {openticket.options.suffix.remove(id)})
|
||||
await openticket.options.loopAll((data,id) => {openticket.options.remove(id)})
|
||||
await openticket.options.suffix.loopAll((data,id) => {openticket.options.suffix.remove(id)})
|
||||
|
||||
//add new options
|
||||
optionConfig.data.forEach((option) => {
|
||||
@@ -36,7 +36,7 @@ export const loadAllOptions = async () => {
|
||||
})
|
||||
|
||||
//update options in tickets
|
||||
openticket.tickets.forEach((ticket) => {
|
||||
await openticket.tickets.loopAll((ticket) => {
|
||||
const optionId = ticket.option.id
|
||||
const option = openticket.options.get(optionId)
|
||||
if (option && option instanceof api.ODTicketOption) ticket.option = option
|
||||
@@ -49,7 +49,7 @@ export const loadAllOptions = async () => {
|
||||
})
|
||||
|
||||
//update roles on config reload
|
||||
openticket.roles.forEach((data,id) => {openticket.roles.remove(id)})
|
||||
await openticket.roles.loopAll((data,id) => {openticket.roles.remove(id)})
|
||||
await (await import("./roleLoader.js")).loadAllRoles()
|
||||
})
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ export const loadAllPanels = async () => {
|
||||
//update panels on config reload
|
||||
panelConfig.onReload(async () => {
|
||||
//clear previous panels
|
||||
openticket.panels.forEach((data,id) => {openticket.panels.remove(id)})
|
||||
await openticket.panels.loopAll((data,id) => {openticket.panels.remove(id)})
|
||||
|
||||
//add new panels
|
||||
panelConfig.data.forEach((panel) => {
|
||||
|
||||
@@ -13,9 +13,9 @@ export const loadAllQuestions = async () => {
|
||||
})
|
||||
|
||||
//update questions on config reload
|
||||
questionConfig.onReload(() => {
|
||||
questionConfig.onReload(async () => {
|
||||
//clear previous questions
|
||||
openticket.questions.forEach((data,id) => {openticket.questions.remove(id)})
|
||||
await openticket.questions.loopAll((data,id) => {openticket.questions.remove(id)})
|
||||
|
||||
//add new questions
|
||||
questionConfig.data.forEach((question) => {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import {openticket, api, utilities} from "../../index"
|
||||
|
||||
export const loadAllRoles = async () => {
|
||||
openticket.options.forEach((opt) => {
|
||||
openticket.options.loopAll((opt) => {
|
||||
if (opt instanceof api.ODRoleOption){
|
||||
openticket.roles.add(loadRole(opt))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user