Browse Source

update fotos

burningTyger 6 years ago
parent
commit
fe7a47863f
1 changed files with 4 additions and 7 deletions
  1. 4 7
      Fotoliste.html

+ 4 - 7
Fotoliste.html

@@ -34,14 +34,11 @@
   export default {
     computed: {
       fotos: async ({schueler, knexConfig}) => {
-        let f = {}
-        const knex = await R.knex(knexConfig)
-        await SchuelerFoto.knex(knex)
+        SchuelerFoto.knex(R.knex(knexConfig))
         const schuelerfotos = await SchuelerFoto.query().whereIn('Schueler_ID', schueler.map(s => s.ID))
-        schuelerfotos.forEach(element => {
-          f[element.Schueler_ID] = Buffer.from(element.Foto, 'binary').toString('base64')
-        })
-        return f
+        return schuelerfotos.reduce(
+          (f, element) => ({...f, [element.Schueler_ID]: Buffer.from(element.Foto, 'binary').toString('base64')}),
+          {})
       }
     },
     data () { return { datum: new Date().toLocaleDateString('de', {day: '2-digit', month: '2-digit', year: 'numeric'}) } },