Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: fix merge code error #364

Merged
merged 2 commits into from
Aug 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion source/portal/src/hooks/useAxiosRequest.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,22 @@
import axios from 'axios';
import { User } from 'oidc-client-ts';
import { useContext } from 'react';
import ConfigContext from 'src/context/config-context';
import { alertMsg } from 'src/utils/utils';

function getUser(authority?: string, clientId?: string) {
const oidcStorage = localStorage.getItem(
`oidc.user:${authority}:${clientId}`,
);
if (!oidcStorage) {
return null;
}
return User.fromStorageString(oidcStorage);
}

const useAxiosRequest = () => {
const config = useContext(ConfigContext);
const user = getUser(config?.oidcIssuer, config?.oidcClientId);
const sendRequest = async ({
url = '',
method = 'get',
Expand All @@ -28,7 +40,6 @@ const useAxiosRequest = () => {
...headers,
'x-api-key': config?.apiKey,
'author': user?.profile.email || 'anonumous user'
// 'x-api-key': "mDX4kERuV4Mv41ctQD4WX1Q9"
},
});
return response.data;
Expand Down
8 changes: 2 additions & 6 deletions source/portal/src/types/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,7 @@ export interface PresignedUrlData {
s3Bucket: string;
s3Prefix: string;
}

export interface CreateChatbotResponse {
Message: string;
}
Expand Down Expand Up @@ -211,11 +212,6 @@ export interface GetChatbotResponse {
Chatbot: Chatbot;
}

export interface PresignedUrlResponse {
data: string;
message: string;
}

export interface PresignedUrlResponse {
data: PresignedUrlData;
message: string;
Expand All @@ -229,4 +225,4 @@ export interface ExecutionResponse {
export interface SelectedOption {
value: string;
label: string;
}
}
Loading