Skip to content

Commit

Permalink
Update UsersService.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
TheAnton1 authored Dec 23, 2023
1 parent 7fd4d8b commit 5f5271a
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions backend/src/services/UsersService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { UserDto } from "../models/dto/UserDto";

class UsersService {

public async login(data: Omit<UserDto, "_id">): Promise<string> {
public async login(data: Omit<UserDto, "_id">): Promise<{ id: string, role: string }> {
const {login, password} = data
if (!login) { throw new Error("Логин не указан") }

Expand All @@ -13,10 +13,10 @@ class UsersService {

if (user.password !== password) { throw new Error("Неверный пароль") }

return user.role;
return { id: String(user._id), role: user.role };

}

}

export const usersService = new UsersService()
export const usersService = new UsersService()

0 comments on commit 5f5271a

Please sign in to comment.