Skip to content

Commit 585f151

Browse files
committed
update logout
1 parent 9933448 commit 585f151

File tree

2 files changed

+6
-16
lines changed

2 files changed

+6
-16
lines changed

src/apps/auth/auth.service.ts

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,9 @@ export class AuthService {
3030
async logout(userAuth: UserInAuth) {
3131

3232
try {
33-
this.userDevicesRepository.update({
33+
console.log(userAuth.id)
34+
console.log(userAuth.deviceUniqueId);
35+
await this.userDevicesRepository.update({
3436
user_id: userAuth.id,
3537
unique_id: userAuth.deviceUniqueId,
3638
}, {
@@ -59,7 +61,7 @@ export class AuthService {
5961

6062
const token = req.header('authorization').replace('Bearer ', '');
6163
console.log(device.refresh_token)
62-
if(!await this.checkPassword(token, device.refresh_token)) {
64+
if(!await this.checkPassword(token, device.refresh_token ?? '')) {
6365
throw new HttpException(this.i18n.t('auth.refresh.invalid-token'), HttpStatus.BAD_REQUEST);
6466
}
6567

@@ -85,18 +87,6 @@ export class AuthService {
8587
return {
8688
tokens
8789
};
88-
89-
// await this.userDevicesRepository.update({
90-
// id: device.id,
91-
// }, {
92-
// refresh_token: null,
93-
// access_token: null,
94-
// })
95-
96-
// return this.i18n.t('auth.refresh.response-success')
97-
// console.log(device);
98-
99-
// this.checkPassword()
10090
}
10191

10292
async login(data: LoginDTO, req: Request) {

src/entities/user-device.entity.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,10 @@ export class UserDevice {
3333
@Column('json', {name: 'current_login'})
3434
current_login:CurrentLoginType;
3535

36-
@Column({name: 'access_token'})
36+
@Column({name: 'access_token', nullable: true})
3737
access_token:string;
3838

39-
@Column({name: 'refresh_token'})
39+
@Column({name: 'refresh_token', nullable: true})
4040
refresh_token:string;
4141

4242
@Column({name: 'fcm_token'})

0 commit comments

Comments
 (0)