Skip to content

Commit ad27040

Browse files
committed
updated auth sample
1 parent 783665e commit ad27040

File tree

1 file changed

+12
-7
lines changed

1 file changed

+12
-7
lines changed

resources/views/documentation/extending-rapid/auth-model.blade.php

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,17 @@
55
@component('components.code')
66
auth: {
77
routes: {
8-
login : 'login', // a route to login a user
9-
logout : 'logout', // a route to logout a user
10-
auth : 'auth' // a route to check for auth
8+
login : 'login', // a route to login a user
9+
logout : 'logout', // a route to logout a user
10+
auth : 'auth', // a route to check for auth
11+
register : 'register' // a route to check for auth
1112
},
1213

1314
methods: {
14-
login : 'post', // the method to use for login
15-
logout : 'post', // the method to use for logout
16-
auth : 'get' // the method to use for auth
15+
login : 'post', // the method to use for login
16+
logout : 'post', // the method to use for logout
17+
auth : 'get', // the method to use for auth
18+
register : 'post' // the method to use for auth
1719
},
1820

1921
modelPrefix: false // whether or not to prefix the model name in the requests
@@ -30,6 +32,7 @@
3032
User.login({ username: 'user', password: 'password' }).then(...) // config.auth.methods.login => /api/login
3133
User.logout().then(...) // config.auth.methods.logout => /api/logoout
3234
User.check().then(...) // config.auth.methods.auth => /api/auth
35+
User.register({ name: 'rapid', email: 'user@email.com', password: 'password' }).then(...) // config.auth.methods.register => /api/register
3336

3437
// all regular methods are still available too
3538
User.find(1).then(...) // GET => /api/user/1
@@ -42,7 +45,8 @@
4245
modelName: 'User',
4346
auth: {
4447
routes: {
45-
auth: 'authenticate'
48+
auth: 'authenticate',
49+
register: 'sign-up'
4650
},
4751
modelPrefix: true
4852
}
@@ -51,4 +55,5 @@
5155
User.login({ username: 'user', password: 'password' }).then(...) // config.auth.methods.login => /api/user/login
5256
User.logout().then(...) // config.auth.methods.logout => /api/user/logoout
5357
User.check().then(...) // config.auth.methods.auth => /api/user/authenticate
58+
User.register({ name: 'rapid', email: 'user@email.com', password: 'password' }).then(...) // config.auth.methods.register => /api/user/sign-up
5459
@endcomponent

0 commit comments

Comments
 (0)