fix: override fields update

This commit is contained in:
Sérgio Salgado 2020-12-14 11:26:54 +00:00 committed by Josh Harvey
parent 1913390eae
commit a432d913be
3 changed files with 10 additions and 3 deletions

View file

@ -49,6 +49,7 @@ const apolloServer = new ApolloServer({
const success = await login.authenticate(token)
if (!success) throw new AuthenticationError('Authentication failed')
return { req: { ...req } }
}
})

View file

@ -311,7 +311,10 @@ const resolvers = {
machineAction: (...[, { deviceId, action, cassette1, cassette2, newName }]) => machineAction({ deviceId, action, cassette1, cassette2, newName }),
createPairingTotem: (...[, { name }]) => pairing.totem(name),
saveAccounts: (...[, { accounts }]) => settingsLoader.saveAccounts(accounts),
setCustomer: (...[, { customerId, customerInput } ]) => customers.updateCustomer(customerId, customerInput),
setCustomer: (root, args, context, info) => {
const token = context.req.cookies && context.req.cookies.token
return customers.updateCustomer(args.customerId, args.customerInput, token)
},
saveConfig: (...[, { config }]) => settingsLoader.saveConfig(config)
.then(it => {
notify()