hyperlog-core / hyperlog-backend

Backend for hyperlog
0 stars 0 forks source link

Fix #91: Execute login mutation after successful registration #95

Closed nikochiko closed 4 years ago

nikochiko commented 4 years ago

Fixes #91

mutation register(username: String!, password: String!, ... more details) {
  success: String!
  errors: [String!]
  login: Login
}

The same schema as normal login can be used for register.login.

register(...) {
  success
  errors
  login {
    token
    user {
      id
      username
      firstName
      ...
    }
  }
}

Changes:

I used this hack which uses the field for Login mutation inside the register mutation. The djagno-graphql-jwt library does not have a utility for doing this directly (they only allow doing it directly with a wrapper on the mutate function). I've created an issue on their github but I think this should work.

nikochiko commented 4 years ago

Great! I had forgotten to mark for review