Skip to content

Commit

Permalink
💚 Fix ci
Browse files Browse the repository at this point in the history
  • Loading branch information
mit-27 committed Apr 29, 2024
1 parent 0ea78c9 commit 9ddfaad
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 96 deletions.
3 changes: 2 additions & 1 deletion apps/client-ts/src/app/(Dashboard)/b2c/profile/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ const Profile = () => {
setProfile(null)
setIdProject("")
queryClient.clear()
router.push('/b2c/login');
router.push('/b2c/login')

}

return (
Expand Down
79 changes: 0 additions & 79 deletions apps/client-ts/src/app/authenticate/page.tsx

This file was deleted.

12 changes: 9 additions & 3 deletions apps/client-ts/src/app/page.tsx
Original file line number Diff line number Diff line change
@@ -1,19 +1,25 @@
"use client"

import React from 'react'
import React,{useEffect} from 'react'
import { useRouter } from "next/navigation";


const Index = () => {
const Home = () => {


const Router = useRouter();

useEffect(() => {

Router.replace('/connections')


},[])

return (
<>
</>
)
}

export default Index
export default Home
3 changes: 2 additions & 1 deletion apps/client-ts/src/components/Nav/user-nav.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@ export function UserNav() {
setProfile(null)
setIdProject("")
queryClient.clear()
router.push('/b2c/login');
router.push('/b2c/login')

}
return (
<DropdownMenu>
Expand Down
25 changes: 13 additions & 12 deletions apps/client-ts/src/hooks/mutations/useApiKeyMutation.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import config from '@/lib/config';
import { useMutation, useQueryClient } from '@tanstack/react-query';
import { toast } from "sonner"
import Cookies from 'js-cookie';

interface IApiKeyDto {
projectId: string;
Expand All @@ -13,25 +14,25 @@ const useApiKeyMutation = () => {
const addApiKey = async (data: IApiKeyDto) => {
//TODO: in cloud environment this step must be done when user logs in directly inside his dashboard
// Fetch the token
const loginResponse = await fetch(`${config.API_URL}/auth/login`, {
method: 'POST',
body: JSON.stringify({ id_user: data.userId.trim(), password_hash: 'my_password' }),
headers: {
'Content-Type': 'application/json',
},
});
// const loginResponse = await fetch(`${config.API_URL}/auth/login`, {
// method: 'POST',
// body: JSON.stringify({ id_user: data.userId.trim(), password_hash: 'my_password' }),
// headers: {
// 'Content-Type': 'application/json',
// },
// });

if (!loginResponse.ok) {
throw new Error('Failed to login');
}
const { access_token } = await loginResponse.json();
// if (!loginResponse.ok) {
// throw new Error('Failed to login');
// }
// const { access_token } = await loginResponse.json();

const response = await fetch(`${config.API_URL}/auth/generate-apikey`, {
method: 'POST',
body: JSON.stringify(data),
headers: {
'Content-Type': 'application/json',
'Authorization': `Bearer ${access_token}`,
'Authorization': `Bearer ${Cookies.get('access_token')}`,
},
});

Expand Down

0 comments on commit 9ddfaad

Please sign in to comment.