essaye de faire foncitonner un bouton
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { Controller, Get, Res, UseGuards, Req, Post, UnauthorizedException, Body } from '@nestjs/common';
|
||||
import { Controller, Get, Res, UseGuards, Req, Post, UnauthorizedException, Body, Options } from '@nestjs/common';
|
||||
import { AuthenticateGuard, FortyTwoAuthGuard } from './guards/42guards';
|
||||
import { AuthenticationService } from './authentication.service';
|
||||
import { Response } from 'express';
|
||||
@@ -17,10 +17,11 @@ export class AuthenticationController {
|
||||
* Route pour l'autentification des utilisateurs
|
||||
*/
|
||||
@Get()
|
||||
@Options()
|
||||
@UseGuards(FortyTwoAuthGuard)
|
||||
login() {
|
||||
login(@Res() response : Response) {
|
||||
console.log('ON EST DANS LOGIN AUTH CONTROLLER');
|
||||
return ;
|
||||
return {msg : 'You are now logged in'};
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -31,7 +32,8 @@ export class AuthenticationController {
|
||||
@Get('redirect')
|
||||
@UseGuards(FortyTwoAuthGuard)
|
||||
async redirect(@Res() response : Response, @Req() request) {
|
||||
response.sendStatus(200);
|
||||
console.log('ON EST DANS REDIRECT AUTH CONTROLLER' + request.user);
|
||||
return request.user;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -8,6 +8,12 @@ import * as connectRedis from 'connect-redis';
|
||||
|
||||
async function bootstrap() {
|
||||
const app = await NestFactory.create(AppModule);
|
||||
// app.enableCors({
|
||||
// allowedHeaders: 'Origin, X-Requested-With, Content-Type, Accept, Authorization, Access-Control-Allow-Credentials, Access-Control-Allow-Origin',
|
||||
// origin: ['http://transcendance:8080','http://127.0.0.1:8080', 'https://api.intra.42.fr',],
|
||||
// credentials: true,
|
||||
// methods: ['GET', 'POST', 'PUT', 'DELETE', 'OPTIONS', 'PATCH'],
|
||||
// });
|
||||
const port = process.env.PORT || 3001;
|
||||
const client = redis.createClient(
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user