Skip to content

Commit 982c352

Browse files
chore: wip
1 parent c9d6fb5 commit 982c352

23 files changed

+181
-34
lines changed

app/Actions/LoginAction.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { Action } from '@stacksjs/actions'
2-
import { attempt } from '@stacksjs/auth'
2+
import { attempt, authToken, team } from '@stacksjs/auth'
33
// import { epmailSubscribeRequest } from '@stacksjs/validation'
44
import type { RequestInstance } from '@stacksjs/types'
55
import { schema } from '@stacksjs/validation'
@@ -34,7 +34,11 @@ export default new Action({
3434
})
3535

3636
if (await attempt({ email, password })) {
37-
return 'success'
37+
const token = await authToken()
38+
39+
const teamValue = await team()
40+
41+
return { token, team: teamValue }
3842
}
3943

4044
return 'fail'

app/Middleware/Team.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ export default new Middleware({
1010

1111
const parts = bearerToken.split(':')
1212

13-
if (parts.length !== 2) {
13+
if (parts.length !== 3) {
1414
throw { message: 'Invalid bearer token format', status: 401 }
1515
}
1616

Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import type { Database } from '@stacksjs/database'
22
export async function up(db: Database<any>) {
33
await db.schema
4-
.createTable('personal_access_tokens_teams')
4+
.createTable('personal_access_token_teams')
55
.addColumn('id', 'integer', col => col.primaryKey().autoIncrement())
6-
.addColumn('teams_id', 'integer')
6+
.addColumn('team_id', 'integer')
77
.addColumn('accesstoken_id', 'integer')
88
.execute()
99
}
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import type { Database } from '@stacksjs/database'
22
export async function up(db: Database<any>) {
33
await db.schema
4-
.createTable('teams_users')
4+
.createTable('team_users')
55
.addColumn('id', 'integer', col => col.primaryKey().autoIncrement())
6-
.addColumn('users_id', 'integer')
76
.addColumn('team_id', 'integer')
7+
.addColumn('user_id', 'integer')
88
.execute()
99
}

0 commit comments

Comments
 (0)