Skip to content

Commit

Permalink
fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
akanshaaa19 committed Nov 24, 2024
1 parent 334a461 commit 36596cb
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 26 deletions.
3 changes: 2 additions & 1 deletion src/config/logs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,11 @@ const setLogs = (message: any, type: string) => {
const userId = getUserSession('id');

let logger: any;
console.log(LOGFLARE_API, LOGFLARE_SOURCE, 'ss');

if (LOGFLARE_API && LOGFLARE_SOURCE) {
const apiKey = LOGFLARE_API;
const sourceToken = LOGFLARE_SOURCE;
const apiKey = LOGFLARE_API;
// create pino-logflare stream
const stream = createWriteStream({
apiKey,
Expand Down
2 changes: 1 addition & 1 deletion src/config/menu.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { organizationHasDynamicRole } from 'common/utils';
import { ANALYTICS_URL, GLIFIC_DOCS_URL, NEW_UI_BLOG } from 'config';
import { ANALYTICS_URL, GLIFIC_DOCS_URL } from 'config';
import { getOrganizationServices } from 'services/AuthService';

const allRoles = ['Staff', 'Manager', 'Admin', 'Dynamic', 'Glific_admin'];
Expand Down
10 changes: 4 additions & 6 deletions src/containers/Auth/Login/Login.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,7 @@ export const Login = () => {

// get the information on current user
const [getCurrentUser, { data: userData, error: userError }] = useLazyQuery(GET_CURRENT_USER);
const [getOrganizationServices, { data: organizationServicesData }] =
useLazyQuery(GET_ORGANIZATION_SERVICES);
const [getOrganizationServices, { data: organizationServicesData }] = useLazyQuery(GET_ORGANIZATION_SERVICES);

useEffect(() => {
if (userData && organizationServicesData) {
Expand All @@ -59,10 +58,7 @@ export const Login = () => {
const userAccessRoles = accessRoles.map((role: any) => role.label);

// check for user role none or empty
if (
(userAccessRoles.includes('None') && userAccessRoles.length === 1) ||
userAccessRoles.length === 0
) {
if ((userAccessRoles.includes('None') && userAccessRoles.length === 1) || userAccessRoles.length === 0) {
accessDenied();
} else {
// needed to redirect after login
Expand Down Expand Up @@ -127,6 +123,8 @@ export const Login = () => {
setAuthSession(response.data.data);
})
.catch((error) => {
console.log(error);

if (error?.response?.status === 403) {
setErrorMessage(error?.response?.data?.error);
setAuthError(' ');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,10 @@ export const PaymentDetails = ({ handleStepChange, saveData }: FormStepProps) =>
designation: Yup.string()
.required(t('Designation is required.'))
.max(25, t('Please enter not more than 25 characters')),
phone: Yup.string().required(t('Phone number is required.')).min(7, t('Enter a valid phone number.')),
phone: Yup.string()
.required(t('Phone number is required.'))
.min(7, t('Enter a valid phone number.'))
.matches(/^\+\d{1,4}\d{7,15}$/, 'Please enter a valid phone number.'),
email: Yup.string().required(t('Email is required.')).email(t('Enter a valid email.')),
});
const initialFormValues: any = {
Expand Down
18 changes: 1 addition & 17 deletions src/containers/Template/List/HSMList/HSMList.test.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { fireEvent, render, screen, waitFor, within } from '@testing-library/react';
import { render, waitFor } from '@testing-library/react';
import { BrowserRouter as Router } from 'react-router-dom';
import { MockedProvider } from '@apollo/client/testing';

Expand Down Expand Up @@ -128,19 +128,3 @@ test('sync api should render notification on error', async () => {
expect(setNotification).toHaveBeenCalledWith('Sorry, failed to sync HSM updates.', 'warning');
});
});

test.only('', async () => {
render(template());

await waitFor(() => {
expect(screen.getByText('Templates')).toBeInTheDocument();
});

fireEvent.mouseDown(screen.getByRole('button'));

const listbox = within(screen.getByRole('listbox'));

fireEvent.click(listbox.getByText(/Failed/i));

screen.debug(document, Infinity);
});

0 comments on commit 36596cb

Please sign in to comment.