Skip to content

Commit

Permalink
🐛 Fix typo and build
Browse files Browse the repository at this point in the history
  • Loading branch information
naelob committed Apr 30, 2024
1 parent e90b062 commit 6922c28
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 16 deletions.
4 changes: 2 additions & 2 deletions apps/client-ts/src/components/RootLayout/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ export const RootLayout = ({children}:{children:React.ReactNode}) => {
<nav className="h-14 flex items-center justify-between px-4">
<div className="hidden lg:block">
<Link href='/'>
Panora.
{/* <img src="/logo.png" className='w-14' /> */}
</Link>
</div>
Expand All @@ -84,8 +85,7 @@ export const RootLayout = ({children}:{children:React.ReactNode}) => {
>
<div className="space-y-4 py-4">
<div className="px-3 py-2">
<div className="space-y-1">

<div className="space-y-3">
<TeamSwitcher className='w-40 ml-3' projects={projectsData? projectsData : []}/>
<MainNav onLinkClick={handlePageChange} className=''/>
</div>
Expand Down
20 changes: 6 additions & 14 deletions packages/api/src/@core/auth/auth.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import { handleServiceError } from '@@core/utils/errors';
import { LoginDto } from './dto/login.dto';
import { VerifyUserDto } from './dto/verify-user.dto';


//TODO: Ensure the JWT is used for user session authentication and that it's short-lived.
@Injectable()
export class AuthService {
Expand Down Expand Up @@ -71,8 +70,6 @@ export class AuthService {

async register(user: CreateUserDto) {
try {


const foundUser = await this.prisma.users.findFirst({
where: { email: user.email },
});
Expand All @@ -82,8 +79,6 @@ export class AuthService {
}

return await this.createUser(user);


} catch (error) {
handleServiceError(error, this.logger);
}
Expand Down Expand Up @@ -128,17 +123,17 @@ export class AuthService {
// },
// });
} catch (error) {
console.log(error)
console.log(error);
handleServiceError(error, this.logger);
}
}

async login(user: LoginDto) {
try {
const foundUser = await this.prisma.users.findUnique({
const foundUser = await this.prisma.users.findFirst({
where: {
email: user.email
}
email: user.email,
},
});

if (!foundUser) {
Expand All @@ -152,24 +147,21 @@ export class AuthService {

if (!isEq) throw new UnauthorizedException('Invalid credentials.');


const { ...userData } = foundUser;

const payload = {
email: userData.email,
sub: userData.id_user,
first_name: userData.first_name,
last_name: userData.last_name
last_name: userData.last_name,
};



return {
user: {
id_user: foundUser.id_user,
email: foundUser.email,
first_name: foundUser.first_name,
last_name: foundUser.last_name
last_name: foundUser.last_name,
},
access_token: this.jwtService.sign(payload, {
secret: process.env.JWT_SECRET,
Expand Down

0 comments on commit 6922c28

Please sign in to comment.