Skip to content

Commit

Permalink
Merge pull request #57 from atlp-rwanda/bg-fix-dashboard
Browse files Browse the repository at this point in the history
  • Loading branch information
Eli250 authored and kayigmb committed Jul 10, 2024
2 parents 799850e + 362d51c commit eee7834
Show file tree
Hide file tree
Showing 34 changed files with 359 additions and 566 deletions.
120 changes: 120 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/__tests__/CreateProdudash.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React from 'react';
import { render, screen, waitFor } from '@testing-library/react';
import '@testing-library/jest-dom';
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
import Page from '@/app/dashboard/addproduct/page';
import Page from '@/app/dashboard/product/create/page';
import request from '@/utils/axios';
import { useRouter } from 'next/navigation';

Expand Down
2 changes: 1 addition & 1 deletion src/__tests__/ProfileeditDashboard.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React from 'react';
import { render, screen, waitFor } from '@testing-library/react';
import '@testing-library/jest-dom';
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
import Page from '@/app/dashboard/profile_/[id]/page';
import Page from '@/app/dashboard/profile/[id]/page';
import request from '@/utils/axios';
import { useRouter } from 'next/navigation';

Expand Down
2 changes: 1 addition & 1 deletion src/__tests__/UpdateReduce.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ describe('updatePassword slice', () => {

const action = {
type: updatePassword.rejected.type,
error: 'Failed to update password',
erro: 'Failed to update password',
};

const state = reducer(initialState, action);
Expand Down
4 changes: 0 additions & 4 deletions src/__tests__/ZcartManagement.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -284,10 +284,6 @@ describe('userCartSlice', () => {
// Assertions
expect(mockedRequest.put).toHaveBeenCalledWith('/carts', expectedItems);
const actions = dispatch.mock.calls.map((call) => call[0]);
console.log(
'1111111111111111111111111111111111111111111111111111111111111111111111111111111',
result,
);
expect(result.payload).toEqual({ data: 'success' });
expect(actions[0].type).toBe(handleRemoveItemInCart.pending.type);
expect(actions[1].type).toBe(handleRemoveItemInCart.rejected.type);
Expand Down
1 change: 0 additions & 1 deletion src/__tests__/app.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ describe('Signup Components', () => {
expect(screen.getByPlaceholderText('Confirm Password')).toBeInTheDocument();
});
it('displays error message on Signup failure', async () => {
console.log('this is env cccccccccccccccccccccc', process.env.URL);
mockaxios.onPost(`${process.env.URL}/users/signup`).reply(409, {
message: 'User with this email already exists',
});
Expand Down
51 changes: 0 additions & 51 deletions src/__tests__/sellerOrders.test.tsx

This file was deleted.

60 changes: 0 additions & 60 deletions src/__tests__/sellerProduct.test.tsx

This file was deleted.

2 changes: 1 addition & 1 deletion src/__tests__/singleProduct.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React from 'react';
import { render, screen, waitFor } from '@testing-library/react';
import '@testing-library/jest-dom';
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
import Page from '@/app/dashboard/products_/[id]/page';
import Page from '@/app/dashboard/product/[id]/page';
import request from '@/utils/axios';
import { useRouter } from 'next/navigation';

Expand Down
2 changes: 1 addition & 1 deletion src/__tests__/updatesDash.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React from 'react';
import { render, screen, waitFor } from '@testing-library/react';
import '@testing-library/jest-dom';
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
import Page from '@/app/dashboard/product_/[id]/page';
import Page from '@/app/dashboard/product/[id]/edit/page';
import request from '@/utils/axios';
import { useRouter } from 'next/navigation';
import { Provider } from 'react-redux';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,11 @@ function page() {
<ProductPopup
product={product}
isOpen={true}
onClose={() => console.log('nothing')}
onClose={() => router.back()}
/>
;

</LayoutDashboard>
);
)
}

export default page;
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ function page() {
<LayoutDashboard pageName="Create Product" isLoading={!user ? true : false}>
<ProductPopup isOpen={true} onClose={() => console.log('nothing')} />;
</LayoutDashboard>
);
)
}

export default page;
File renamed without changes.
10 changes: 6 additions & 4 deletions src/app/dashboard/users/page.tsx
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
'use client';
import React, { use, useEffect, useState } from 'react';
import DashNavbar from '@/components/DashNavbar';
import HeaderDash from '@/components/headerDash';
import UsersPageAdmin from '@/components/UsersAdmin';
import LayoutDashboard from '@/components/LayoutDashboard';
import { useRouter } from 'next/navigation';

function page() {
const [user, setUser] = useState<any>();
const [user, setUser] = useState<any>();
const router = useRouter()
useEffect(() => {
const categ = async () => {
const user = localStorage.getItem('profile') || '';
const finalUser = JSON.parse(user);

if (finalUser.User.Role.name !== 'admin') {
router.back();
}
setUser(finalUser?.User);
console.log(finalUser);
};
Expand Down
Loading

0 comments on commit eee7834

Please sign in to comment.