refactor: user agent parsing

This commit is contained in:
Sérgio Salgado 2020-10-26 16:03:02 +00:00 committed by Josh Harvey
parent 791b275cdf
commit 839e6aae47
8 changed files with 21 additions and 63 deletions

View file

@ -160,6 +160,8 @@ const typeDefs = gql`
token: String!
name: String!
created: Date!
user_agent: String!
ip_address: String!
}
type Transaction {
@ -224,7 +226,7 @@ const typeDefs = gql`
transactionsCsv(from: Date, until: Date, limit: Int, offset: Int): String
accounts: JSONObject
config: JSONObject
userTokens(browser: String!, os: String!): [UserToken]
userTokens: [UserToken]
}
enum MachineAction {
@ -283,7 +285,7 @@ const resolvers = {
transactions.batch(from, until, limit, offset).then(parseAsync),
config: () => settingsLoader.loadLatestConfigOrNone(),
accounts: () => settingsLoader.loadAccounts(),
userTokens: (...[, { browser, os }]) => tokenManager.getTokenList(browser, os)
userTokens: () => tokenManager.getTokenList()
},
Mutation: {
machineAction: (...[, { deviceId, action, cassette1, cassette2, newName }]) => machineAction({ deviceId, action, cassette1, cassette2, newName }),