| 19 | getters: {}, |
| 20 | actions: { |
| 21 | async init() { |
| 22 | if (this.inited) { |
| 23 | return |
| 24 | } |
| 25 | this.inited = true |
| 26 | const file = join(window.Server.MysqlDir!, 'group/group.json') |
| 27 | fs.existsSync(file).then(async (e) => { |
| 28 | if (e) { |
| 29 | const arr: Array<any> = [] |
| 30 | try { |
| 31 | const json = await fs.readFile(file) |
| 32 | const jsonArr: any = JSON.parse(json) |
| 33 | jsonArr.forEach((j: any) => { |
| 34 | delete j?.version?.fetching |
| 35 | delete j?.version?.running |
| 36 | }) |
| 37 | arr.push(...jsonArr) |
| 38 | } catch { |
| 39 | /* empty */ |
| 40 | } |
| 41 | this.all.push(...arr) |
| 42 | } |
| 43 | }) |
| 44 | }, |
| 45 | async save() { |
| 46 | const json = JSON.parse(JSON.stringify(this.all)) |
| 47 | json.forEach((j: any) => { |