Skip to content

Commit

Permalink
Merge pull request #12 from fga-eps-mds/qas
Browse files Browse the repository at this point in the history
Qas
  • Loading branch information
paulohgontijoo authored Jul 31, 2024
2 parents 262011f + 9e06d2e commit 67312ed
Show file tree
Hide file tree
Showing 6 changed files with 5 additions and 11 deletions.
1 change: 0 additions & 1 deletion src/app/(auth)/oauth/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ const OAuthContent = () => {
if (session) {
setAuthenticated(true);
setMessage('Login efetuado com sucesso! redirecionando');
await new Promise((resolve) => setTimeout(resolve, 5000));
window.location.href = '/home';
}
};
Expand Down
2 changes: 1 addition & 1 deletion src/app/components/forms/signInForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export function SingInForm() {
if (session.data) {
toast.success('Login efetuado com sucesso!');
setTimeout(() => {}, 1000);
window.location.href = '/';
window.location.href = '/home';
}
}, [session.data]);

Expand Down
3 changes: 2 additions & 1 deletion src/app/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ import { useSession } from 'next-auth/react';

export default function LandingPage() {
const session = useSession();

console.log('Home session: ', session + " " + process.env.NEXT_PUBLIC_API_URL!);

if (session.data) {
window.location.href = '/home';
}
Expand Down
1 change: 0 additions & 1 deletion src/lib/auth.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { Awaitable, NextAuthOptions } from 'next-auth';
import CredentialsProvider from 'next-auth/providers/credentials';
import { loginWithEmailAndPassword } from '@/services/user.service';
import { privateRoutes } from '@/contains/constants';
import GoogleProvider from 'next-auth/providers/google';
import AzureADProvider from 'next-auth/providers/azure-ad';
import { JWT } from 'next-auth/jwt';
Expand Down
2 changes: 1 addition & 1 deletion src/services/api.service.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import axios from 'axios';

const api = axios.create({
baseURL: process.env.NEXT_PUBLIC_API_URL,
baseURL: process.env.NEXT_PUBLIC_API_URL!,
headers: {
'Content-Type': 'application/json',
},
Expand Down
7 changes: 1 addition & 6 deletions src/services/user.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,6 @@ export const loginWithEmailAndPassword = async (
}
};

export const googleCallback = async () => {
const response = await api.get('auth/google/callback');
return response;
};

export const getUsers = async () => {
try {
const response = await api.get('/users');
Expand All @@ -59,4 +54,4 @@ export const updateUserRole = async (userId: string, newRole: string) => {
console.error('Failed to update user role:', error);
throw error;
}
};
};

0 comments on commit 67312ed

Please sign in to comment.