[WIP] Login Logout
This commit is contained in:
85
app/Http/Controllers/Api/MemberController.php
Normal file
85
app/Http/Controllers/Api/MemberController.php
Normal file
@@ -0,0 +1,85 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers\Api;
|
||||||
|
|
||||||
|
use App\Http\Controllers\Controller;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
|
||||||
|
class MemberController extends Controller
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Display a listing of the resource.
|
||||||
|
*
|
||||||
|
* @return \Illuminate\Http\Response
|
||||||
|
*/
|
||||||
|
public function index()
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show the form for creating a new resource.
|
||||||
|
*
|
||||||
|
* @return \Illuminate\Http\Response
|
||||||
|
*/
|
||||||
|
public function create()
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Store a newly created resource in storage.
|
||||||
|
*
|
||||||
|
* @param \Illuminate\Http\Request $request
|
||||||
|
* @return \Illuminate\Http\Response
|
||||||
|
*/
|
||||||
|
public function store(Request $request)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Display the specified resource.
|
||||||
|
*
|
||||||
|
* @param int $id
|
||||||
|
* @return \Illuminate\Http\Response
|
||||||
|
*/
|
||||||
|
public function show($id)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show the form for editing the specified resource.
|
||||||
|
*
|
||||||
|
* @param int $id
|
||||||
|
* @return \Illuminate\Http\Response
|
||||||
|
*/
|
||||||
|
public function edit($id)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update the specified resource in storage.
|
||||||
|
*
|
||||||
|
* @param \Illuminate\Http\Request $request
|
||||||
|
* @param int $id
|
||||||
|
* @return \Illuminate\Http\Response
|
||||||
|
*/
|
||||||
|
public function update(Request $request, $id)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Remove the specified resource from storage.
|
||||||
|
*
|
||||||
|
* @param int $id
|
||||||
|
* @return \Illuminate\Http\Response
|
||||||
|
*/
|
||||||
|
public function destroy($id)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
}
|
||||||
11
app/Models/Member.php
Normal file
11
app/Models/Member.php
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class Member extends Model
|
||||||
|
{
|
||||||
|
use HasFactory;
|
||||||
|
}
|
||||||
@@ -0,0 +1,45 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
return new class extends Migration
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function up()
|
||||||
|
{
|
||||||
|
Schema::create('members', function (Blueprint $table) {
|
||||||
|
$table->id();
|
||||||
|
$table->unsignedBigInteger('user_id')->nullable();
|
||||||
|
$table->unsignedBigInteger('corporate_id')->nullable();
|
||||||
|
$table->string('name_prefix');
|
||||||
|
$table->string('name');
|
||||||
|
$table->string('name_suffix');
|
||||||
|
$table->date('birth_date');
|
||||||
|
$table->string('gender');
|
||||||
|
$table->boolean('active');
|
||||||
|
|
||||||
|
$table->timestamps();
|
||||||
|
$table->softDeletes();
|
||||||
|
|
||||||
|
$table->unsignedBigInteger('created_by')->nullable();
|
||||||
|
$table->unsignedBigInteger('updated_by')->nullable();
|
||||||
|
$table->unsignedBigInteger('deleted_by')->nullable();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function down()
|
||||||
|
{
|
||||||
|
Schema::dropIfExists('members');
|
||||||
|
}
|
||||||
|
};
|
||||||
19
database/seeders/DummyMemberSeeder.php
Normal file
19
database/seeders/DummyMemberSeeder.php
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Database\Seeders;
|
||||||
|
|
||||||
|
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
|
||||||
|
use Illuminate\Database\Seeder;
|
||||||
|
|
||||||
|
class DummyMemberSeeder extends Seeder
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the database seeds.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function run()
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -3,3 +3,5 @@ GENERATE_SOURCEMAP=false
|
|||||||
PORT=8083
|
PORT=8083
|
||||||
|
|
||||||
REACT_APP_HOST_API_URL="http://localhost:8000"
|
REACT_APP_HOST_API_URL="http://localhost:8000"
|
||||||
|
|
||||||
|
VITE_API_URL="http://localhost:8000/api"
|
||||||
|
|||||||
@@ -52,6 +52,7 @@
|
|||||||
"date-fns": "^2.28.0",
|
"date-fns": "^2.28.0",
|
||||||
"framer-motion": "^6.3.3",
|
"framer-motion": "^6.3.3",
|
||||||
"history": "^5.3.0",
|
"history": "^5.3.0",
|
||||||
|
"jsx-runtime": "^1.2.0",
|
||||||
"lodash": "^4.17.21",
|
"lodash": "^4.17.21",
|
||||||
"notistack": "^2.0.4",
|
"notistack": "^2.0.4",
|
||||||
"nprogress": "^0.2.0",
|
"nprogress": "^0.2.0",
|
||||||
|
|||||||
2092
frontend/client-portal/pnpm-lock.yaml
generated
2092
frontend/client-portal/pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load Diff
66
frontend/client-portal/src/@types/auth.ts
Normal file
66
frontend/client-portal/src/@types/auth.ts
Normal file
@@ -0,0 +1,66 @@
|
|||||||
|
import { UserCredential } from 'firebase/auth';
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------
|
||||||
|
|
||||||
|
export type ActionMap<M extends { [index: string]: any }> = {
|
||||||
|
[Key in keyof M]: M[Key] extends undefined
|
||||||
|
? {
|
||||||
|
type: Key;
|
||||||
|
}
|
||||||
|
: {
|
||||||
|
type: Key;
|
||||||
|
payload: M[Key];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
export type AuthUser = null | Record<string, any>;
|
||||||
|
|
||||||
|
export type AuthState = {
|
||||||
|
isAuthenticated: boolean;
|
||||||
|
isInitialized: boolean;
|
||||||
|
user: AuthUser;
|
||||||
|
};
|
||||||
|
|
||||||
|
export type JWTContextType = {
|
||||||
|
isAuthenticated: boolean;
|
||||||
|
isInitialized: boolean;
|
||||||
|
user: AuthUser;
|
||||||
|
method: 'jwt';
|
||||||
|
login: (email: string, password: string) => Promise<void>;
|
||||||
|
register: (email: string, password: string, firstName: string, lastName: string) => Promise<void>;
|
||||||
|
logout: () => Promise<void>;
|
||||||
|
};
|
||||||
|
|
||||||
|
export type FirebaseContextType = {
|
||||||
|
isAuthenticated: boolean;
|
||||||
|
isInitialized: boolean;
|
||||||
|
user: AuthUser;
|
||||||
|
method: 'firebase';
|
||||||
|
login: (email: string, password: string) => Promise<UserCredential>;
|
||||||
|
register: (email: string, password: string, firstName: string, lastName: string) => Promise<void>;
|
||||||
|
logout: () => Promise<void>;
|
||||||
|
};
|
||||||
|
|
||||||
|
export type AWSCognitoContextType = {
|
||||||
|
isAuthenticated: boolean;
|
||||||
|
isInitialized: boolean;
|
||||||
|
user: AuthUser;
|
||||||
|
method: 'cognito';
|
||||||
|
login: (email: string, password: string) => Promise<unknown>;
|
||||||
|
register: (
|
||||||
|
email: string,
|
||||||
|
password: string,
|
||||||
|
firstName: string,
|
||||||
|
lastName: string
|
||||||
|
) => Promise<unknown>;
|
||||||
|
logout: VoidFunction;
|
||||||
|
};
|
||||||
|
|
||||||
|
export type Auth0ContextType = {
|
||||||
|
isAuthenticated: boolean;
|
||||||
|
isInitialized: boolean;
|
||||||
|
user: AuthUser;
|
||||||
|
method: 'auth0';
|
||||||
|
login: () => Promise<void>;
|
||||||
|
logout: VoidFunction;
|
||||||
|
};
|
||||||
55
frontend/client-portal/src/@types/blog.ts
Normal file
55
frontend/client-portal/src/@types/blog.ts
Normal file
@@ -0,0 +1,55 @@
|
|||||||
|
export type NewPostFormValues = {
|
||||||
|
title: string;
|
||||||
|
description: string;
|
||||||
|
content: string;
|
||||||
|
cover: File | any;
|
||||||
|
tags: string[];
|
||||||
|
publish: boolean;
|
||||||
|
comments: boolean;
|
||||||
|
metaTitle: string;
|
||||||
|
metaDescription: string;
|
||||||
|
metaKeywords: string[];
|
||||||
|
};
|
||||||
|
|
||||||
|
export type PostComment = {
|
||||||
|
id: string;
|
||||||
|
name: string;
|
||||||
|
avatarUrl: string;
|
||||||
|
message: string;
|
||||||
|
postedAt: Date;
|
||||||
|
users: {
|
||||||
|
id: string;
|
||||||
|
name: string;
|
||||||
|
avatarUrl: string;
|
||||||
|
}[];
|
||||||
|
replyComment: {
|
||||||
|
id: string;
|
||||||
|
userId: string;
|
||||||
|
message: string;
|
||||||
|
postedAt: Date;
|
||||||
|
tagUser?: string;
|
||||||
|
}[];
|
||||||
|
};
|
||||||
|
|
||||||
|
export type Post = {
|
||||||
|
id: string;
|
||||||
|
cover: string;
|
||||||
|
title: string;
|
||||||
|
description: string;
|
||||||
|
createdAt: Date | string | number;
|
||||||
|
view: number;
|
||||||
|
comment: number;
|
||||||
|
share: number;
|
||||||
|
favorite: number;
|
||||||
|
author: {
|
||||||
|
name: string;
|
||||||
|
avatarUrl: string;
|
||||||
|
};
|
||||||
|
tags: string[];
|
||||||
|
body: string;
|
||||||
|
favoritePerson: {
|
||||||
|
name: string;
|
||||||
|
avatarUrl: string;
|
||||||
|
}[];
|
||||||
|
comments: PostComment[];
|
||||||
|
};
|
||||||
14
frontend/client-portal/src/@types/calendar.ts
Normal file
14
frontend/client-portal/src/@types/calendar.ts
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
import { EventInput } from '@fullcalendar/common';
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------
|
||||||
|
|
||||||
|
export type CalendarView = 'dayGridMonth' | 'timeGridWeek' | 'timeGridDay' | 'listWeek';
|
||||||
|
|
||||||
|
export type CalendarState = {
|
||||||
|
isLoading: boolean;
|
||||||
|
error: Error | string | null;
|
||||||
|
events: EventInput[];
|
||||||
|
isOpenModal: boolean;
|
||||||
|
selectedEventId: null | string;
|
||||||
|
selectedRange: null | { start: Date; end: Date };
|
||||||
|
};
|
||||||
65
frontend/client-portal/src/@types/chat.ts
Normal file
65
frontend/client-portal/src/@types/chat.ts
Normal file
@@ -0,0 +1,65 @@
|
|||||||
|
// ----------------------------------------------------------------------
|
||||||
|
|
||||||
|
export type Contact = {
|
||||||
|
id: string;
|
||||||
|
name: string;
|
||||||
|
username: string;
|
||||||
|
avatar: string;
|
||||||
|
address: string;
|
||||||
|
phone: string;
|
||||||
|
email: string;
|
||||||
|
lastActivity: Date | string | number;
|
||||||
|
status: string;
|
||||||
|
position: string;
|
||||||
|
};
|
||||||
|
|
||||||
|
export type Participant = {
|
||||||
|
id: string;
|
||||||
|
name: string;
|
||||||
|
username: string;
|
||||||
|
avatar: string;
|
||||||
|
address?: string;
|
||||||
|
phone?: string;
|
||||||
|
email?: string;
|
||||||
|
lastActivity?: Date | string | number;
|
||||||
|
status?: 'online' | 'offline' | 'away' | 'busy';
|
||||||
|
position?: string;
|
||||||
|
};
|
||||||
|
|
||||||
|
export type TextMessage = {
|
||||||
|
id: string;
|
||||||
|
body: string;
|
||||||
|
contentType: 'text';
|
||||||
|
attachments: string[];
|
||||||
|
createdAt: Date;
|
||||||
|
senderId: string;
|
||||||
|
};
|
||||||
|
|
||||||
|
export type ImageMessage = {
|
||||||
|
id: string;
|
||||||
|
body: string;
|
||||||
|
contentType: 'image';
|
||||||
|
attachments: string[];
|
||||||
|
createdAt: Date;
|
||||||
|
senderId: string;
|
||||||
|
};
|
||||||
|
|
||||||
|
export type Message = TextMessage | ImageMessage;
|
||||||
|
|
||||||
|
export type Conversation = {
|
||||||
|
id: string;
|
||||||
|
participants: Participant[];
|
||||||
|
type: string;
|
||||||
|
unreadCount: number;
|
||||||
|
messages: Message[];
|
||||||
|
};
|
||||||
|
|
||||||
|
export type SendMessage = {
|
||||||
|
conversationId: string;
|
||||||
|
messageId: string;
|
||||||
|
message: string;
|
||||||
|
contentType: 'text';
|
||||||
|
attachments: string[];
|
||||||
|
createdAt: Date | string | number;
|
||||||
|
senderId: string;
|
||||||
|
};
|
||||||
36
frontend/client-portal/src/@types/invoice.ts
Normal file
36
frontend/client-portal/src/@types/invoice.ts
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
// ----------------------------------------------------------------------
|
||||||
|
|
||||||
|
export type InvoiceAddress = {
|
||||||
|
id: string;
|
||||||
|
name: string;
|
||||||
|
address: string;
|
||||||
|
company: string;
|
||||||
|
email: string;
|
||||||
|
phone: string;
|
||||||
|
};
|
||||||
|
|
||||||
|
export type InvoiceItem = {
|
||||||
|
id: string;
|
||||||
|
title: string;
|
||||||
|
description: string;
|
||||||
|
quantity: number;
|
||||||
|
price: number;
|
||||||
|
total: number;
|
||||||
|
service: string;
|
||||||
|
};
|
||||||
|
|
||||||
|
export type Invoice = {
|
||||||
|
id: string;
|
||||||
|
sent: number;
|
||||||
|
status: string;
|
||||||
|
totalPrice: number;
|
||||||
|
invoiceNumber: string;
|
||||||
|
subTotalPrice: number;
|
||||||
|
taxes: number | string;
|
||||||
|
discount: number | string;
|
||||||
|
invoiceFrom: InvoiceAddress;
|
||||||
|
invoiceTo: InvoiceAddress;
|
||||||
|
createDate: Date | number;
|
||||||
|
dueDate: Date | number;
|
||||||
|
items: InvoiceItem[];
|
||||||
|
};
|
||||||
37
frontend/client-portal/src/@types/kanban.ts
Normal file
37
frontend/client-portal/src/@types/kanban.ts
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
export type CardComment = {
|
||||||
|
id: string;
|
||||||
|
avatar: string;
|
||||||
|
name: string;
|
||||||
|
createdAt: Date | string | number;
|
||||||
|
messageType: 'image' | 'text';
|
||||||
|
message: string;
|
||||||
|
};
|
||||||
|
|
||||||
|
export type Assignee = {
|
||||||
|
id: string;
|
||||||
|
avatar: string;
|
||||||
|
name: string;
|
||||||
|
};
|
||||||
|
|
||||||
|
export type KanbanCard = {
|
||||||
|
id: string;
|
||||||
|
name: string;
|
||||||
|
description?: string;
|
||||||
|
assignee: Assignee[];
|
||||||
|
due: [number | null, number | null];
|
||||||
|
attachments: string[];
|
||||||
|
comments: CardComment[];
|
||||||
|
completed: boolean;
|
||||||
|
};
|
||||||
|
|
||||||
|
export type KanbanColumn = {
|
||||||
|
id: string;
|
||||||
|
name: string;
|
||||||
|
cardIds: string[];
|
||||||
|
};
|
||||||
|
|
||||||
|
export type KanbanBoard = {
|
||||||
|
cards: KanbanCard[];
|
||||||
|
columns: KanbanColumn[];
|
||||||
|
columnOrder: string[];
|
||||||
|
};
|
||||||
45
frontend/client-portal/src/@types/mail.ts
Normal file
45
frontend/client-portal/src/@types/mail.ts
Normal file
@@ -0,0 +1,45 @@
|
|||||||
|
// ----------------------------------------------------------------------
|
||||||
|
|
||||||
|
export type MailLabelId =
|
||||||
|
| 'all'
|
||||||
|
| 'inbox'
|
||||||
|
| 'sent'
|
||||||
|
| 'drafts'
|
||||||
|
| 'trash'
|
||||||
|
| 'spam'
|
||||||
|
| 'important'
|
||||||
|
| 'starred'
|
||||||
|
| 'id_social'
|
||||||
|
| 'id_promotions'
|
||||||
|
| 'id_forums';
|
||||||
|
|
||||||
|
export type MailLabel = {
|
||||||
|
id: MailLabelId;
|
||||||
|
type: string;
|
||||||
|
name: string;
|
||||||
|
unreadCount: number;
|
||||||
|
color?: string;
|
||||||
|
};
|
||||||
|
|
||||||
|
export type Mail = {
|
||||||
|
id: string;
|
||||||
|
labelIds: string[];
|
||||||
|
folder: string | undefined;
|
||||||
|
isImportant: boolean;
|
||||||
|
isStarred: boolean;
|
||||||
|
isUnread: boolean;
|
||||||
|
subject: string;
|
||||||
|
message: string;
|
||||||
|
createdAt: Date | string | number;
|
||||||
|
files: string[];
|
||||||
|
from: {
|
||||||
|
name: string;
|
||||||
|
email: string;
|
||||||
|
avatar: null | string;
|
||||||
|
};
|
||||||
|
to: {
|
||||||
|
name: string;
|
||||||
|
email: string;
|
||||||
|
avatar: null | string;
|
||||||
|
}[];
|
||||||
|
};
|
||||||
126
frontend/client-portal/src/@types/product.ts
Normal file
126
frontend/client-portal/src/@types/product.ts
Normal file
@@ -0,0 +1,126 @@
|
|||||||
|
// ----------------------------------------------------------------------
|
||||||
|
|
||||||
|
export type PaymentType = 'paypal' | 'credit_card' | 'cash';
|
||||||
|
|
||||||
|
export type ProductStatus = 'sale' | 'new' | '';
|
||||||
|
|
||||||
|
export type ProductInventoryType = 'in_stock' | 'out_of_stock' | 'low_stock';
|
||||||
|
|
||||||
|
export type ProductCategory = 'Accessories' | 'Apparel' | 'Shoes' | string;
|
||||||
|
|
||||||
|
export type ProductGender = 'Men' | 'Women' | 'Kids' | string;
|
||||||
|
|
||||||
|
export type OnCreateBilling = (address: BillingAddress) => void;
|
||||||
|
|
||||||
|
export type ProductRating = {
|
||||||
|
name: string;
|
||||||
|
starCount: number;
|
||||||
|
reviewCount: number;
|
||||||
|
};
|
||||||
|
|
||||||
|
export type ProductReview = {
|
||||||
|
id: string;
|
||||||
|
name: string;
|
||||||
|
avatarUrl: string;
|
||||||
|
comment: string;
|
||||||
|
rating: number;
|
||||||
|
isPurchased: boolean;
|
||||||
|
helpful: number;
|
||||||
|
postedAt: Date | string | number;
|
||||||
|
};
|
||||||
|
|
||||||
|
export type Product = {
|
||||||
|
id: string;
|
||||||
|
cover: string;
|
||||||
|
images: string[];
|
||||||
|
name: string;
|
||||||
|
price: number;
|
||||||
|
code: string;
|
||||||
|
sku: string;
|
||||||
|
tags: string[];
|
||||||
|
priceSale: number | null;
|
||||||
|
totalRating: number;
|
||||||
|
totalReview: number;
|
||||||
|
ratings: ProductRating[];
|
||||||
|
reviews: ProductReview[];
|
||||||
|
colors: string[];
|
||||||
|
status: ProductStatus;
|
||||||
|
inventoryType: ProductInventoryType;
|
||||||
|
sizes: string[];
|
||||||
|
available: number;
|
||||||
|
description: string;
|
||||||
|
sold: number;
|
||||||
|
createdAt: Date | string | number;
|
||||||
|
category: ProductCategory;
|
||||||
|
gender: ProductGender;
|
||||||
|
};
|
||||||
|
|
||||||
|
export type CartItem = {
|
||||||
|
id: string;
|
||||||
|
name: string;
|
||||||
|
cover: string;
|
||||||
|
available: number;
|
||||||
|
price: number;
|
||||||
|
color: string;
|
||||||
|
size: string;
|
||||||
|
quantity: number;
|
||||||
|
subtotal: number;
|
||||||
|
};
|
||||||
|
|
||||||
|
export type BillingAddress = {
|
||||||
|
receiver: string;
|
||||||
|
phone: string;
|
||||||
|
fullAddress: string;
|
||||||
|
addressType: string;
|
||||||
|
isDefault: boolean;
|
||||||
|
};
|
||||||
|
|
||||||
|
export type ProductState = {
|
||||||
|
isLoading: boolean;
|
||||||
|
error: Error | string | null;
|
||||||
|
products: Product[];
|
||||||
|
product: Product | null;
|
||||||
|
sortBy: string | null;
|
||||||
|
filters: {
|
||||||
|
gender: string[];
|
||||||
|
category: string;
|
||||||
|
colors: string[];
|
||||||
|
priceRange: string;
|
||||||
|
rating: string;
|
||||||
|
};
|
||||||
|
checkout: {
|
||||||
|
activeStep: number;
|
||||||
|
cart: CartItem[];
|
||||||
|
subtotal: number;
|
||||||
|
total: number;
|
||||||
|
discount: number;
|
||||||
|
shipping: number;
|
||||||
|
billing: BillingAddress | null;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
export type ProductFilter = {
|
||||||
|
gender: string[];
|
||||||
|
category: string;
|
||||||
|
colors: string[];
|
||||||
|
priceRange: string;
|
||||||
|
rating: string;
|
||||||
|
};
|
||||||
|
|
||||||
|
export type DeliveryOption = {
|
||||||
|
value: number;
|
||||||
|
title: string;
|
||||||
|
description: string;
|
||||||
|
};
|
||||||
|
|
||||||
|
export type PaymentOption = {
|
||||||
|
value: PaymentType;
|
||||||
|
title: string;
|
||||||
|
description: string;
|
||||||
|
icons: string[];
|
||||||
|
};
|
||||||
|
|
||||||
|
export type CardOption = {
|
||||||
|
value: string;
|
||||||
|
label: string;
|
||||||
|
};
|
||||||
128
frontend/client-portal/src/@types/user.ts
Normal file
128
frontend/client-portal/src/@types/user.ts
Normal file
@@ -0,0 +1,128 @@
|
|||||||
|
// ----------------------------------------------------------------------
|
||||||
|
|
||||||
|
export type UserInvoice = {
|
||||||
|
id: string;
|
||||||
|
createdAt: Date | string | number;
|
||||||
|
price: number;
|
||||||
|
};
|
||||||
|
|
||||||
|
export type CreditCard = {
|
||||||
|
id: string;
|
||||||
|
cardNumber: string;
|
||||||
|
cardType: string;
|
||||||
|
};
|
||||||
|
|
||||||
|
export type Follower = {
|
||||||
|
id: string;
|
||||||
|
avatarUrl: string;
|
||||||
|
name: string;
|
||||||
|
country: string;
|
||||||
|
isFollowed: boolean;
|
||||||
|
};
|
||||||
|
|
||||||
|
export type Gallery = {
|
||||||
|
id: string;
|
||||||
|
title: string;
|
||||||
|
postAt: Date | string | number;
|
||||||
|
imageUrl: string;
|
||||||
|
};
|
||||||
|
|
||||||
|
export type UserAddressBook = {
|
||||||
|
id: string;
|
||||||
|
name: string;
|
||||||
|
phone: string;
|
||||||
|
country: string;
|
||||||
|
state: string;
|
||||||
|
city: string;
|
||||||
|
street: string;
|
||||||
|
zipCode: string;
|
||||||
|
};
|
||||||
|
|
||||||
|
export type Profile = {
|
||||||
|
id: string;
|
||||||
|
cover: string;
|
||||||
|
position: string;
|
||||||
|
follower: number;
|
||||||
|
following: number;
|
||||||
|
quote: string;
|
||||||
|
country: string;
|
||||||
|
email: string;
|
||||||
|
company: string;
|
||||||
|
school: string;
|
||||||
|
role: string;
|
||||||
|
facebookLink: string;
|
||||||
|
instagramLink: string;
|
||||||
|
linkedinLink: string;
|
||||||
|
twitterLink: string;
|
||||||
|
};
|
||||||
|
|
||||||
|
export type UserManager = {
|
||||||
|
id: string;
|
||||||
|
avatarUrl: string;
|
||||||
|
name: string;
|
||||||
|
email: string;
|
||||||
|
phoneNumber: string;
|
||||||
|
address: string;
|
||||||
|
country: string;
|
||||||
|
state: string;
|
||||||
|
city: string;
|
||||||
|
zipCode: string;
|
||||||
|
company: string;
|
||||||
|
isVerified: boolean;
|
||||||
|
status: string;
|
||||||
|
role: string;
|
||||||
|
};
|
||||||
|
|
||||||
|
export type UserData = {
|
||||||
|
id: string;
|
||||||
|
avatarUrl: string;
|
||||||
|
cover: string;
|
||||||
|
name: string;
|
||||||
|
follower: number;
|
||||||
|
following: number;
|
||||||
|
totalPost: number;
|
||||||
|
position: string;
|
||||||
|
};
|
||||||
|
|
||||||
|
export type NotificationSettings = {
|
||||||
|
activityComments: boolean;
|
||||||
|
activityAnswers: boolean;
|
||||||
|
activityFollows: boolean;
|
||||||
|
applicationNews: boolean;
|
||||||
|
applicationProduct: boolean;
|
||||||
|
applicationBlog: boolean;
|
||||||
|
};
|
||||||
|
|
||||||
|
export type Friend = {
|
||||||
|
id: string;
|
||||||
|
avatarUrl: string;
|
||||||
|
name: string;
|
||||||
|
role: string;
|
||||||
|
};
|
||||||
|
|
||||||
|
export type UserPost = {
|
||||||
|
id: string;
|
||||||
|
author: {
|
||||||
|
id: string;
|
||||||
|
avatarUrl: string;
|
||||||
|
name: string;
|
||||||
|
};
|
||||||
|
isLiked: boolean;
|
||||||
|
createdAt: Date | string | number;
|
||||||
|
media: string;
|
||||||
|
message: string;
|
||||||
|
personLikes: {
|
||||||
|
name: string;
|
||||||
|
avatarUrl: string;
|
||||||
|
}[];
|
||||||
|
comments: {
|
||||||
|
id: string;
|
||||||
|
author: {
|
||||||
|
id: string;
|
||||||
|
avatarUrl: string;
|
||||||
|
name: string;
|
||||||
|
};
|
||||||
|
createdAt: Date | string | number;
|
||||||
|
message: string;
|
||||||
|
}[];
|
||||||
|
};
|
||||||
@@ -2,11 +2,11 @@ import { createContext, ReactNode, useEffect, useReducer } from 'react';
|
|||||||
// utils
|
// utils
|
||||||
import axios from '../utils/axios';
|
import axios from '../utils/axios';
|
||||||
// import { isValidToken, setSession } from '../utils/jwt';
|
// import { isValidToken, setSession } from '../utils/jwt';
|
||||||
import { setSession, getSession } from '../utils/token';
|
import { setSession, getSession, getUser } from '../utils/token';
|
||||||
// @types
|
// @types
|
||||||
import { ActionMap, AuthState, AuthUser, JWTContextType } from '../@types/auth';
|
import { ActionMap, AuthState, AuthUser, JWTContextType } from '../@types/auth';
|
||||||
|
|
||||||
// ----------------------------------------------------------------------
|
// ----------------------------------------------------------------------
|
||||||
|
import { Navigate, useLocation } from 'react-router-dom';
|
||||||
|
|
||||||
enum Types {
|
enum Types {
|
||||||
Initial = 'INITIALIZE',
|
Initial = 'INITIALIZE',
|
||||||
@@ -80,25 +80,27 @@ type AuthProviderProps = {
|
|||||||
|
|
||||||
function AuthProvider({ children }: AuthProviderProps) {
|
function AuthProvider({ children }: AuthProviderProps) {
|
||||||
const [state, dispatch] = useReducer(JWTReducer, initialState);
|
const [state, dispatch] = useReducer(JWTReducer, initialState);
|
||||||
|
let location = useLocation();
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const initialize = async () => {
|
const initialize = async () => {
|
||||||
|
console.log('initialize', state)
|
||||||
try {
|
try {
|
||||||
const accessToken = getSession();
|
const accessToken = getSession();
|
||||||
|
|
||||||
if (accessToken) {
|
if (accessToken) {
|
||||||
setSession(accessToken);
|
setSession(accessToken);
|
||||||
|
|
||||||
// const response = await axios.get('/api/account/my-account');
|
const response = await axios.get('/user');
|
||||||
// const { user } = response.data;
|
const user = response.data;
|
||||||
|
|
||||||
// dispatch({
|
dispatch({
|
||||||
// type: Types.Initial,
|
type: Types.Initial,
|
||||||
// payload: {
|
payload: {
|
||||||
// isAuthenticated: true,
|
isAuthenticated: true,
|
||||||
// user,
|
user,
|
||||||
// },
|
},
|
||||||
// });
|
});
|
||||||
} else {
|
} else {
|
||||||
dispatch({
|
dispatch({
|
||||||
type: Types.Initial,
|
type: Types.Initial,
|
||||||
@@ -122,11 +124,10 @@ function AuthProvider({ children }: AuthProviderProps) {
|
|||||||
|
|
||||||
initialize();
|
initialize();
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
// const csrf = () => axios.get('/sanctum/csrf-cookie')
|
// const csrf = () => axios.get('/sanctum/csrf-cookie')
|
||||||
|
|
||||||
const login = async (email: string, password: string) => {
|
const login = async (email: string, password: string) => {
|
||||||
axios
|
return axios
|
||||||
.post('/login', { email, password })
|
.post('/login', { email, password })
|
||||||
.then((response) => {
|
.then((response) => {
|
||||||
const { user, token } = response.data;
|
const { user, token } = response.data;
|
||||||
@@ -140,7 +141,8 @@ function AuthProvider({ children }: AuthProviderProps) {
|
|||||||
});
|
});
|
||||||
})
|
})
|
||||||
.catch(error => {
|
.catch(error => {
|
||||||
if (error.response.status !== 422) throw error
|
if (error.response.status !== 404) throw error.response
|
||||||
|
if (error.response.status !== 422) throw error.response
|
||||||
})
|
})
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -163,7 +165,7 @@ function AuthProvider({ children }: AuthProviderProps) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const logout = async () => {
|
const logout = async () => {
|
||||||
console.log('LOGOUT CALLEDS NAKJSNDKJASNDKJASDNAKJSND')
|
console.log('LOGGING OUT')
|
||||||
setSession(null);
|
setSession(null);
|
||||||
dispatch({ type: Types.Logout });
|
dispatch({ type: Types.Logout });
|
||||||
};
|
};
|
||||||
@@ -181,6 +183,28 @@ function AuthProvider({ children }: AuthProviderProps) {
|
|||||||
{children}
|
{children}
|
||||||
</AuthContext.Provider>
|
</AuthContext.Provider>
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// if (state.isInitialized) {
|
||||||
|
// return (!state.isAuthenticated && location.pathname !== '/auth/login') ?
|
||||||
|
// (<Navigate to="/auth/login" replace={true} />)
|
||||||
|
// : false && location.pathname == '/auth/login' ?
|
||||||
|
// (<Navigate to="/dashboard" replace={true} />)
|
||||||
|
// : (
|
||||||
|
// <AuthContext.Provider
|
||||||
|
// value={{
|
||||||
|
// ...state,
|
||||||
|
// method: 'jwt',
|
||||||
|
// login,
|
||||||
|
// logout,
|
||||||
|
// register,
|
||||||
|
// }}
|
||||||
|
// >
|
||||||
|
// {children}
|
||||||
|
// </AuthContext.Provider>
|
||||||
|
// );
|
||||||
|
// } else {
|
||||||
|
// return (<Navigate to="/auth/login" replace={true} />)
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
export { AuthContext, AuthProvider };
|
export { AuthContext, AuthProvider };
|
||||||
|
|||||||
@@ -20,9 +20,7 @@ const navConfig = [
|
|||||||
{
|
{
|
||||||
subheader: 'general v3.2.0',
|
subheader: 'general v3.2.0',
|
||||||
items: [
|
items: [
|
||||||
{ title: 'One', path: '/dashboard/one', icon: ICONS.dashboard },
|
{ title: 'Dashboard', path: '/dashboard', icon: ICONS.dashboard },
|
||||||
{ title: 'Two', path: '/dashboard/two', icon: ICONS.ecommerce },
|
|
||||||
{ title: 'Three', path: '/dashboard/three', icon: ICONS.analytics },
|
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import useAuth from '../hooks/useAuth';
|
|||||||
|
|
||||||
// ----------------------------------------------------------------------
|
// ----------------------------------------------------------------------
|
||||||
|
|
||||||
export default function PageOne() {
|
export default function Dashboard() {
|
||||||
const { themeStretch } = useSettings();
|
const { themeStretch } = useSettings();
|
||||||
|
|
||||||
const { logout } = useAuth();
|
const { logout } = useAuth();
|
||||||
@@ -19,10 +19,10 @@ export default function PageOne() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Page title="Page One">
|
<Page title="Dashboard">
|
||||||
<Container maxWidth={themeStretch ? false : 'xl'}>
|
<Container maxWidth={themeStretch ? false : 'xl'}>
|
||||||
<Typography variant="h3" component="h1" paragraph>
|
<Typography variant="h3" component="h1" paragraph>
|
||||||
Page One
|
Dashboard
|
||||||
</Typography>
|
</Typography>
|
||||||
<Typography gutterBottom>
|
<Typography gutterBottom>
|
||||||
Curabitur turpis. Vestibulum facilisis, purus nec pulvinar iaculis, ligula mi congue nunc,
|
Curabitur turpis. Vestibulum facilisis, purus nec pulvinar iaculis, ligula mi congue nunc,
|
||||||
@@ -1,38 +0,0 @@
|
|||||||
// @mui
|
|
||||||
import { Container, Typography } from '@mui/material';
|
|
||||||
// hooks
|
|
||||||
import useSettings from '../hooks/useSettings';
|
|
||||||
// components
|
|
||||||
import Page from '../components/Page';
|
|
||||||
|
|
||||||
// ----------------------------------------------------------------------
|
|
||||||
|
|
||||||
export default function PageFive() {
|
|
||||||
const { themeStretch } = useSettings();
|
|
||||||
|
|
||||||
return (
|
|
||||||
<Page title="Page Five">
|
|
||||||
<Container maxWidth={themeStretch ? false : 'xl'}>
|
|
||||||
<Typography variant="h3" component="h1" paragraph>
|
|
||||||
Page Five
|
|
||||||
</Typography>
|
|
||||||
<Typography gutterBottom>
|
|
||||||
Curabitur turpis. Vestibulum facilisis, purus nec pulvinar iaculis, ligula mi congue nunc,
|
|
||||||
vitae euismod ligula urna in dolor. Nam quam nunc, blandit vel, luctus pulvinar, hendrerit
|
|
||||||
id, lorem. Phasellus blandit leo ut odio. Vestibulum ante ipsum primis in faucibus orci
|
|
||||||
luctus et ultrices posuere cubilia Curae; Fusce id purus. Aliquam lorem ante, dapibus in,
|
|
||||||
viverra quis, feugiat a, tellus. In consectetuer turpis ut velit. Aenean posuere, tortor
|
|
||||||
sed cursus feugiat, nunc augue blandit nunc, eu sollicitudin urna dolor sagittis lacus.
|
|
||||||
Vestibulum suscipit nulla quis orci. Nam commodo suscipit quam. Sed a libero.
|
|
||||||
</Typography>
|
|
||||||
<Typography>
|
|
||||||
Praesent ac sem eget est egestas volutpat. Phasellus viverra nulla ut metus varius
|
|
||||||
laoreet. Curabitur ullamcorper ultricies nisi. Ut non enim eleifend felis pretium feugiat.
|
|
||||||
Donec mi odio, faucibus at, scelerisque quis, convallis in, nisi. Fusce vel dui. Quisque
|
|
||||||
libero metus, condimentum nec, tempor a, commodo mollis, magna. In enim justo, rhoncus ut,
|
|
||||||
imperdiet a, venenatis vitae, justo. Cras dapibus.
|
|
||||||
</Typography>
|
|
||||||
</Container>
|
|
||||||
</Page>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
@@ -1,37 +0,0 @@
|
|||||||
// @mui
|
|
||||||
import { Container, Typography } from '@mui/material';
|
|
||||||
// hooks
|
|
||||||
import useSettings from '../hooks/useSettings';
|
|
||||||
// components
|
|
||||||
import Page from '../components/Page';
|
|
||||||
// ----------------------------------------------------------------------
|
|
||||||
|
|
||||||
export default function PageFour() {
|
|
||||||
const { themeStretch } = useSettings();
|
|
||||||
|
|
||||||
return (
|
|
||||||
<Page title="Page Four">
|
|
||||||
<Container maxWidth={themeStretch ? false : 'xl'}>
|
|
||||||
<Typography variant="h3" component="h1" paragraph>
|
|
||||||
Page Four
|
|
||||||
</Typography>
|
|
||||||
<Typography gutterBottom>
|
|
||||||
Curabitur turpis. Vestibulum facilisis, purus nec pulvinar iaculis, ligula mi congue nunc,
|
|
||||||
vitae euismod ligula urna in dolor. Nam quam nunc, blandit vel, luctus pulvinar, hendrerit
|
|
||||||
id, lorem. Phasellus blandit leo ut odio. Vestibulum ante ipsum primis in faucibus orci
|
|
||||||
luctus et ultrices posuere cubilia Curae; Fusce id purus. Aliquam lorem ante, dapibus in,
|
|
||||||
viverra quis, feugiat a, tellus. In consectetuer turpis ut velit. Aenean posuere, tortor
|
|
||||||
sed cursus feugiat, nunc augue blandit nunc, eu sollicitudin urna dolor sagittis lacus.
|
|
||||||
Vestibulum suscipit nulla quis orci. Nam commodo suscipit quam. Sed a libero.
|
|
||||||
</Typography>
|
|
||||||
<Typography>
|
|
||||||
Praesent ac sem eget est egestas volutpat. Phasellus viverra nulla ut metus varius
|
|
||||||
laoreet. Curabitur ullamcorper ultricies nisi. Ut non enim eleifend felis pretium feugiat.
|
|
||||||
Donec mi odio, faucibus at, scelerisque quis, convallis in, nisi. Fusce vel dui. Quisque
|
|
||||||
libero metus, condimentum nec, tempor a, commodo mollis, magna. In enim justo, rhoncus ut,
|
|
||||||
imperdiet a, venenatis vitae, justo. Cras dapibus.
|
|
||||||
</Typography>
|
|
||||||
</Container>
|
|
||||||
</Page>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
@@ -1,38 +0,0 @@
|
|||||||
// @mui
|
|
||||||
import { Container, Typography } from '@mui/material';
|
|
||||||
// hooks
|
|
||||||
import useSettings from '../hooks/useSettings';
|
|
||||||
// components
|
|
||||||
import Page from '../components/Page';
|
|
||||||
|
|
||||||
// ----------------------------------------------------------------------
|
|
||||||
|
|
||||||
export default function PageSix() {
|
|
||||||
const { themeStretch } = useSettings();
|
|
||||||
|
|
||||||
return (
|
|
||||||
<Page title="Page Six">
|
|
||||||
<Container maxWidth={themeStretch ? false : 'xl'}>
|
|
||||||
<Typography variant="h3" component="h1" paragraph>
|
|
||||||
Page Six
|
|
||||||
</Typography>
|
|
||||||
<Typography gutterBottom>
|
|
||||||
Curabitur turpis. Vestibulum facilisis, purus nec pulvinar iaculis, ligula mi congue nunc,
|
|
||||||
vitae euismod ligula urna in dolor. Nam quam nunc, blandit vel, luctus pulvinar, hendrerit
|
|
||||||
id, lorem. Phasellus blandit leo ut odio. Vestibulum ante ipsum primis in faucibus orci
|
|
||||||
luctus et ultrices posuere cubilia Curae; Fusce id purus. Aliquam lorem ante, dapibus in,
|
|
||||||
viverra quis, feugiat a, tellus. In consectetuer turpis ut velit. Aenean posuere, tortor
|
|
||||||
sed cursus feugiat, nunc augue blandit nunc, eu sollicitudin urna dolor sagittis lacus.
|
|
||||||
Vestibulum suscipit nulla quis orci. Nam commodo suscipit quam. Sed a libero.
|
|
||||||
</Typography>
|
|
||||||
<Typography>
|
|
||||||
Praesent ac sem eget est egestas volutpat. Phasellus viverra nulla ut metus varius
|
|
||||||
laoreet. Curabitur ullamcorper ultricies nisi. Ut non enim eleifend felis pretium feugiat.
|
|
||||||
Donec mi odio, faucibus at, scelerisque quis, convallis in, nisi. Fusce vel dui. Quisque
|
|
||||||
libero metus, condimentum nec, tempor a, commodo mollis, magna. In enim justo, rhoncus ut,
|
|
||||||
imperdiet a, venenatis vitae, justo. Cras dapibus.
|
|
||||||
</Typography>
|
|
||||||
</Container>
|
|
||||||
</Page>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
@@ -1,38 +0,0 @@
|
|||||||
// @mui
|
|
||||||
import { Container, Typography } from '@mui/material';
|
|
||||||
// hooks
|
|
||||||
import useSettings from '../hooks/useSettings';
|
|
||||||
// components
|
|
||||||
import Page from '../components/Page';
|
|
||||||
|
|
||||||
// ----------------------------------------------------------------------
|
|
||||||
|
|
||||||
export default function PageThree() {
|
|
||||||
const { themeStretch } = useSettings();
|
|
||||||
|
|
||||||
return (
|
|
||||||
<Page title="Page Three">
|
|
||||||
<Container maxWidth={themeStretch ? false : 'xl'}>
|
|
||||||
<Typography variant="h3" component="h1" paragraph>
|
|
||||||
Page Three
|
|
||||||
</Typography>
|
|
||||||
<Typography gutterBottom>
|
|
||||||
Curabitur turpis. Vestibulum facilisis, purus nec pulvinar iaculis, ligula mi congue nunc,
|
|
||||||
vitae euismod ligula urna in dolor. Nam quam nunc, blandit vel, luctus pulvinar, hendrerit
|
|
||||||
id, lorem. Phasellus blandit leo ut odio. Vestibulum ante ipsum primis in faucibus orci
|
|
||||||
luctus et ultrices posuere cubilia Curae; Fusce id purus. Aliquam lorem ante, dapibus in,
|
|
||||||
viverra quis, feugiat a, tellus. In consectetuer turpis ut velit. Aenean posuere, tortor
|
|
||||||
sed cursus feugiat, nunc augue blandit nunc, eu sollicitudin urna dolor sagittis lacus.
|
|
||||||
Vestibulum suscipit nulla quis orci. Nam commodo suscipit quam. Sed a libero.
|
|
||||||
</Typography>
|
|
||||||
<Typography>
|
|
||||||
Praesent ac sem eget est egestas volutpat. Phasellus viverra nulla ut metus varius
|
|
||||||
laoreet. Curabitur ullamcorper ultricies nisi. Ut non enim eleifend felis pretium feugiat.
|
|
||||||
Donec mi odio, faucibus at, scelerisque quis, convallis in, nisi. Fusce vel dui. Quisque
|
|
||||||
libero metus, condimentum nec, tempor a, commodo mollis, magna. In enim justo, rhoncus ut,
|
|
||||||
imperdiet a, venenatis vitae, justo. Cras dapibus.
|
|
||||||
</Typography>
|
|
||||||
</Container>
|
|
||||||
</Page>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
@@ -1,38 +0,0 @@
|
|||||||
// @mui
|
|
||||||
import { Container, Typography } from '@mui/material';
|
|
||||||
// hooks
|
|
||||||
import useSettings from '../hooks/useSettings';
|
|
||||||
// components
|
|
||||||
import Page from '../components/Page';
|
|
||||||
|
|
||||||
// ----------------------------------------------------------------------
|
|
||||||
|
|
||||||
export default function PageTwo() {
|
|
||||||
const { themeStretch } = useSettings();
|
|
||||||
|
|
||||||
return (
|
|
||||||
<Page title="Page Two">
|
|
||||||
<Container maxWidth={themeStretch ? false : 'xl'}>
|
|
||||||
<Typography variant="h3" component="h1" paragraph>
|
|
||||||
Page Two
|
|
||||||
</Typography>
|
|
||||||
<Typography gutterBottom>
|
|
||||||
Curabitur turpis. Vestibulum facilisis, purus nec pulvinar iaculis, ligula mi congue nunc,
|
|
||||||
vitae euismod ligula urna in dolor. Nam quam nunc, blandit vel, luctus pulvinar, hendrerit
|
|
||||||
id, lorem. Phasellus blandit leo ut odio. Vestibulum ante ipsum primis in faucibus orci
|
|
||||||
luctus et ultrices posuere cubilia Curae; Fusce id purus. Aliquam lorem ante, dapibus in,
|
|
||||||
viverra quis, feugiat a, tellus. In consectetuer turpis ut velit. Aenean posuere, tortor
|
|
||||||
sed cursus feugiat, nunc augue blandit nunc, eu sollicitudin urna dolor sagittis lacus.
|
|
||||||
Vestibulum suscipit nulla quis orci. Nam commodo suscipit quam. Sed a libero.
|
|
||||||
</Typography>
|
|
||||||
<Typography>
|
|
||||||
Praesent ac sem eget est egestas volutpat. Phasellus viverra nulla ut metus varius
|
|
||||||
laoreet. Curabitur ullamcorper ultricies nisi. Ut non enim eleifend felis pretium feugiat.
|
|
||||||
Donec mi odio, faucibus at, scelerisque quis, convallis in, nisi. Fusce vel dui. Quisque
|
|
||||||
libero metus, condimentum nec, tempor a, commodo mollis, magna. In enim justo, rhoncus ut,
|
|
||||||
imperdiet a, venenatis vitae, justo. Cras dapibus.
|
|
||||||
</Typography>
|
|
||||||
</Container>
|
|
||||||
</Page>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
@@ -60,6 +60,10 @@ export default function Router() {
|
|||||||
path: '/',
|
path: '/',
|
||||||
element: <DashboardLayout />,
|
element: <DashboardLayout />,
|
||||||
children:[
|
children:[
|
||||||
|
{
|
||||||
|
path: 'dashboard',
|
||||||
|
element: <AuthProvider><Dashboard /></AuthProvider>,
|
||||||
|
},
|
||||||
{
|
{
|
||||||
path: 'medicines',
|
path: 'medicines',
|
||||||
element: <AuthProvider><Medicines /></AuthProvider>,
|
element: <AuthProvider><Medicines /></AuthProvider>,
|
||||||
@@ -105,14 +109,10 @@ export default function Router() {
|
|||||||
|
|
||||||
const Login = Loadable(lazy(() => import('../pages/auth/Login')));
|
const Login = Loadable(lazy(() => import('../pages/auth/Login')));
|
||||||
|
|
||||||
|
// Dashboard
|
||||||
|
const Dashboard = Loadable(lazy(() => import('../pages/Dashboard')));
|
||||||
|
const NotFound = Loadable(lazy(() => import('../pages/Page404')));
|
||||||
|
|
||||||
// Medicines
|
// Medicines
|
||||||
const Medicines = Loadable(lazy(() => import('../pages/Medicines/Index')));
|
const Medicines = Loadable(lazy(() => import('../pages/Medicines/Index')));
|
||||||
const MedicinesCreate = Loadable(lazy(() => import('../pages/Medicines/Create')));
|
const MedicinesCreate = Loadable(lazy(() => import('../pages/Medicines/Create')));
|
||||||
|
|
||||||
// Dashboard
|
|
||||||
const PageOne = Loadable(lazy(() => import('../pages/PageOne')));
|
|
||||||
const PageTwo = Loadable(lazy(() => import('../pages/PageTwo')));
|
|
||||||
const PageThree = Loadable(lazy(() => import('../pages/PageThree')));
|
|
||||||
const PageFour = Loadable(lazy(() => import('../pages/PageFour')));
|
|
||||||
const PageSix = Loadable(lazy(() => import('../pages/PageSix')));
|
|
||||||
const NotFound = Loadable(lazy(() => import('../pages/Page404')));
|
|
||||||
|
|||||||
@@ -58,15 +58,16 @@ export default function LoginForm() {
|
|||||||
|
|
||||||
const onSubmit = async (data: FormValuesProps) => {
|
const onSubmit = async (data: FormValuesProps) => {
|
||||||
try {
|
try {
|
||||||
await login(data.email, data.password );
|
const loginResult = await login(data.email, data.password );
|
||||||
navigate('/dashboard/one');
|
|
||||||
|
navigate('/dashboard');
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error);
|
console.error(error);
|
||||||
|
|
||||||
reset();
|
reset();
|
||||||
|
|
||||||
if (isMountedRef.current) {
|
if (isMountedRef.current) {
|
||||||
setError('afterSubmit', { ...error, message: error.message });
|
setError('afterSubmit', { ...error, message: error.data.message });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ const axiosInstance = axios.create({
|
|||||||
|
|
||||||
axiosInstance.interceptors.response.use(
|
axiosInstance.interceptors.response.use(
|
||||||
(response) => response,
|
(response) => response,
|
||||||
(error) => Promise.reject((error.response && error.response.data) || 'Something went wrong')
|
(error) => Promise.reject((error) || 'Something went wrong')
|
||||||
);
|
);
|
||||||
|
|
||||||
export default axiosInstance;
|
export default axiosInstance;
|
||||||
|
|||||||
@@ -38,6 +38,15 @@ const setSession = (accessToken: string | null) => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const getSession = () => window.localStorage.getItem('accessToken')
|
const setUser = (user: any) => {
|
||||||
|
if (user) {
|
||||||
|
localStorage.setItem('user', user);
|
||||||
|
} else {
|
||||||
|
localStorage.removeItem('user');
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
export { setSession, getSession };
|
const getSession = () => window.localStorage.getItem('accessToken')
|
||||||
|
const getUser = () => window.localStorage.getItem('user')
|
||||||
|
|
||||||
|
export { setSession, getSession, setUser, getUser };
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import useAuth from '../hooks/useAuth';
|
|||||||
|
|
||||||
// ----------------------------------------------------------------------
|
// ----------------------------------------------------------------------
|
||||||
|
|
||||||
export default function PageOne() {
|
export default function Dashboard() {
|
||||||
const { themeStretch } = useSettings();
|
const { themeStretch } = useSettings();
|
||||||
|
|
||||||
const { logout } = useAuth();
|
const { logout } = useAuth();
|
||||||
@@ -19,10 +19,10 @@ export default function PageOne() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Page title="Page One">
|
<Page title="Dashboard">
|
||||||
<Container maxWidth={themeStretch ? false : 'xl'}>
|
<Container maxWidth={themeStretch ? false : 'xl'}>
|
||||||
<Typography variant="h3" component="h1" paragraph>
|
<Typography variant="h3" component="h1" paragraph>
|
||||||
Page One
|
Dashboard
|
||||||
</Typography>
|
</Typography>
|
||||||
<Typography gutterBottom>
|
<Typography gutterBottom>
|
||||||
Curabitur turpis. Vestibulum facilisis, purus nec pulvinar iaculis, ligula mi congue nunc,
|
Curabitur turpis. Vestibulum facilisis, purus nec pulvinar iaculis, ligula mi congue nunc,
|
||||||
@@ -1,38 +0,0 @@
|
|||||||
// @mui
|
|
||||||
import { Container, Typography } from '@mui/material';
|
|
||||||
// hooks
|
|
||||||
import useSettings from '../hooks/useSettings';
|
|
||||||
// components
|
|
||||||
import Page from '../components/Page';
|
|
||||||
|
|
||||||
// ----------------------------------------------------------------------
|
|
||||||
|
|
||||||
export default function PageFive() {
|
|
||||||
const { themeStretch } = useSettings();
|
|
||||||
|
|
||||||
return (
|
|
||||||
<Page title="Page Five">
|
|
||||||
<Container maxWidth={themeStretch ? false : 'xl'}>
|
|
||||||
<Typography variant="h3" component="h1" paragraph>
|
|
||||||
Page Five
|
|
||||||
</Typography>
|
|
||||||
<Typography gutterBottom>
|
|
||||||
Curabitur turpis. Vestibulum facilisis, purus nec pulvinar iaculis, ligula mi congue nunc,
|
|
||||||
vitae euismod ligula urna in dolor. Nam quam nunc, blandit vel, luctus pulvinar, hendrerit
|
|
||||||
id, lorem. Phasellus blandit leo ut odio. Vestibulum ante ipsum primis in faucibus orci
|
|
||||||
luctus et ultrices posuere cubilia Curae; Fusce id purus. Aliquam lorem ante, dapibus in,
|
|
||||||
viverra quis, feugiat a, tellus. In consectetuer turpis ut velit. Aenean posuere, tortor
|
|
||||||
sed cursus feugiat, nunc augue blandit nunc, eu sollicitudin urna dolor sagittis lacus.
|
|
||||||
Vestibulum suscipit nulla quis orci. Nam commodo suscipit quam. Sed a libero.
|
|
||||||
</Typography>
|
|
||||||
<Typography>
|
|
||||||
Praesent ac sem eget est egestas volutpat. Phasellus viverra nulla ut metus varius
|
|
||||||
laoreet. Curabitur ullamcorper ultricies nisi. Ut non enim eleifend felis pretium feugiat.
|
|
||||||
Donec mi odio, faucibus at, scelerisque quis, convallis in, nisi. Fusce vel dui. Quisque
|
|
||||||
libero metus, condimentum nec, tempor a, commodo mollis, magna. In enim justo, rhoncus ut,
|
|
||||||
imperdiet a, venenatis vitae, justo. Cras dapibus.
|
|
||||||
</Typography>
|
|
||||||
</Container>
|
|
||||||
</Page>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
@@ -1,37 +0,0 @@
|
|||||||
// @mui
|
|
||||||
import { Container, Typography } from '@mui/material';
|
|
||||||
// hooks
|
|
||||||
import useSettings from '../hooks/useSettings';
|
|
||||||
// components
|
|
||||||
import Page from '../components/Page';
|
|
||||||
// ----------------------------------------------------------------------
|
|
||||||
|
|
||||||
export default function PageFour() {
|
|
||||||
const { themeStretch } = useSettings();
|
|
||||||
|
|
||||||
return (
|
|
||||||
<Page title="Page Four">
|
|
||||||
<Container maxWidth={themeStretch ? false : 'xl'}>
|
|
||||||
<Typography variant="h3" component="h1" paragraph>
|
|
||||||
Page Four
|
|
||||||
</Typography>
|
|
||||||
<Typography gutterBottom>
|
|
||||||
Curabitur turpis. Vestibulum facilisis, purus nec pulvinar iaculis, ligula mi congue nunc,
|
|
||||||
vitae euismod ligula urna in dolor. Nam quam nunc, blandit vel, luctus pulvinar, hendrerit
|
|
||||||
id, lorem. Phasellus blandit leo ut odio. Vestibulum ante ipsum primis in faucibus orci
|
|
||||||
luctus et ultrices posuere cubilia Curae; Fusce id purus. Aliquam lorem ante, dapibus in,
|
|
||||||
viverra quis, feugiat a, tellus. In consectetuer turpis ut velit. Aenean posuere, tortor
|
|
||||||
sed cursus feugiat, nunc augue blandit nunc, eu sollicitudin urna dolor sagittis lacus.
|
|
||||||
Vestibulum suscipit nulla quis orci. Nam commodo suscipit quam. Sed a libero.
|
|
||||||
</Typography>
|
|
||||||
<Typography>
|
|
||||||
Praesent ac sem eget est egestas volutpat. Phasellus viverra nulla ut metus varius
|
|
||||||
laoreet. Curabitur ullamcorper ultricies nisi. Ut non enim eleifend felis pretium feugiat.
|
|
||||||
Donec mi odio, faucibus at, scelerisque quis, convallis in, nisi. Fusce vel dui. Quisque
|
|
||||||
libero metus, condimentum nec, tempor a, commodo mollis, magna. In enim justo, rhoncus ut,
|
|
||||||
imperdiet a, venenatis vitae, justo. Cras dapibus.
|
|
||||||
</Typography>
|
|
||||||
</Container>
|
|
||||||
</Page>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
@@ -1,38 +0,0 @@
|
|||||||
// @mui
|
|
||||||
import { Container, Typography } from '@mui/material';
|
|
||||||
// hooks
|
|
||||||
import useSettings from '../hooks/useSettings';
|
|
||||||
// components
|
|
||||||
import Page from '../components/Page';
|
|
||||||
|
|
||||||
// ----------------------------------------------------------------------
|
|
||||||
|
|
||||||
export default function PageSix() {
|
|
||||||
const { themeStretch } = useSettings();
|
|
||||||
|
|
||||||
return (
|
|
||||||
<Page title="Page Six">
|
|
||||||
<Container maxWidth={themeStretch ? false : 'xl'}>
|
|
||||||
<Typography variant="h3" component="h1" paragraph>
|
|
||||||
Page Six
|
|
||||||
</Typography>
|
|
||||||
<Typography gutterBottom>
|
|
||||||
Curabitur turpis. Vestibulum facilisis, purus nec pulvinar iaculis, ligula mi congue nunc,
|
|
||||||
vitae euismod ligula urna in dolor. Nam quam nunc, blandit vel, luctus pulvinar, hendrerit
|
|
||||||
id, lorem. Phasellus blandit leo ut odio. Vestibulum ante ipsum primis in faucibus orci
|
|
||||||
luctus et ultrices posuere cubilia Curae; Fusce id purus. Aliquam lorem ante, dapibus in,
|
|
||||||
viverra quis, feugiat a, tellus. In consectetuer turpis ut velit. Aenean posuere, tortor
|
|
||||||
sed cursus feugiat, nunc augue blandit nunc, eu sollicitudin urna dolor sagittis lacus.
|
|
||||||
Vestibulum suscipit nulla quis orci. Nam commodo suscipit quam. Sed a libero.
|
|
||||||
</Typography>
|
|
||||||
<Typography>
|
|
||||||
Praesent ac sem eget est egestas volutpat. Phasellus viverra nulla ut metus varius
|
|
||||||
laoreet. Curabitur ullamcorper ultricies nisi. Ut non enim eleifend felis pretium feugiat.
|
|
||||||
Donec mi odio, faucibus at, scelerisque quis, convallis in, nisi. Fusce vel dui. Quisque
|
|
||||||
libero metus, condimentum nec, tempor a, commodo mollis, magna. In enim justo, rhoncus ut,
|
|
||||||
imperdiet a, venenatis vitae, justo. Cras dapibus.
|
|
||||||
</Typography>
|
|
||||||
</Container>
|
|
||||||
</Page>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
@@ -1,38 +0,0 @@
|
|||||||
// @mui
|
|
||||||
import { Container, Typography } from '@mui/material';
|
|
||||||
// hooks
|
|
||||||
import useSettings from '../hooks/useSettings';
|
|
||||||
// components
|
|
||||||
import Page from '../components/Page';
|
|
||||||
|
|
||||||
// ----------------------------------------------------------------------
|
|
||||||
|
|
||||||
export default function PageThree() {
|
|
||||||
const { themeStretch } = useSettings();
|
|
||||||
|
|
||||||
return (
|
|
||||||
<Page title="Page Three">
|
|
||||||
<Container maxWidth={themeStretch ? false : 'xl'}>
|
|
||||||
<Typography variant="h3" component="h1" paragraph>
|
|
||||||
Page Three
|
|
||||||
</Typography>
|
|
||||||
<Typography gutterBottom>
|
|
||||||
Curabitur turpis. Vestibulum facilisis, purus nec pulvinar iaculis, ligula mi congue nunc,
|
|
||||||
vitae euismod ligula urna in dolor. Nam quam nunc, blandit vel, luctus pulvinar, hendrerit
|
|
||||||
id, lorem. Phasellus blandit leo ut odio. Vestibulum ante ipsum primis in faucibus orci
|
|
||||||
luctus et ultrices posuere cubilia Curae; Fusce id purus. Aliquam lorem ante, dapibus in,
|
|
||||||
viverra quis, feugiat a, tellus. In consectetuer turpis ut velit. Aenean posuere, tortor
|
|
||||||
sed cursus feugiat, nunc augue blandit nunc, eu sollicitudin urna dolor sagittis lacus.
|
|
||||||
Vestibulum suscipit nulla quis orci. Nam commodo suscipit quam. Sed a libero.
|
|
||||||
</Typography>
|
|
||||||
<Typography>
|
|
||||||
Praesent ac sem eget est egestas volutpat. Phasellus viverra nulla ut metus varius
|
|
||||||
laoreet. Curabitur ullamcorper ultricies nisi. Ut non enim eleifend felis pretium feugiat.
|
|
||||||
Donec mi odio, faucibus at, scelerisque quis, convallis in, nisi. Fusce vel dui. Quisque
|
|
||||||
libero metus, condimentum nec, tempor a, commodo mollis, magna. In enim justo, rhoncus ut,
|
|
||||||
imperdiet a, venenatis vitae, justo. Cras dapibus.
|
|
||||||
</Typography>
|
|
||||||
</Container>
|
|
||||||
</Page>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
@@ -1,38 +0,0 @@
|
|||||||
// @mui
|
|
||||||
import { Container, Typography } from '@mui/material';
|
|
||||||
// hooks
|
|
||||||
import useSettings from '../hooks/useSettings';
|
|
||||||
// components
|
|
||||||
import Page from '../components/Page';
|
|
||||||
|
|
||||||
// ----------------------------------------------------------------------
|
|
||||||
|
|
||||||
export default function PageTwo() {
|
|
||||||
const { themeStretch } = useSettings();
|
|
||||||
|
|
||||||
return (
|
|
||||||
<Page title="Page Two">
|
|
||||||
<Container maxWidth={themeStretch ? false : 'xl'}>
|
|
||||||
<Typography variant="h3" component="h1" paragraph>
|
|
||||||
Page Two
|
|
||||||
</Typography>
|
|
||||||
<Typography gutterBottom>
|
|
||||||
Curabitur turpis. Vestibulum facilisis, purus nec pulvinar iaculis, ligula mi congue nunc,
|
|
||||||
vitae euismod ligula urna in dolor. Nam quam nunc, blandit vel, luctus pulvinar, hendrerit
|
|
||||||
id, lorem. Phasellus blandit leo ut odio. Vestibulum ante ipsum primis in faucibus orci
|
|
||||||
luctus et ultrices posuere cubilia Curae; Fusce id purus. Aliquam lorem ante, dapibus in,
|
|
||||||
viverra quis, feugiat a, tellus. In consectetuer turpis ut velit. Aenean posuere, tortor
|
|
||||||
sed cursus feugiat, nunc augue blandit nunc, eu sollicitudin urna dolor sagittis lacus.
|
|
||||||
Vestibulum suscipit nulla quis orci. Nam commodo suscipit quam. Sed a libero.
|
|
||||||
</Typography>
|
|
||||||
<Typography>
|
|
||||||
Praesent ac sem eget est egestas volutpat. Phasellus viverra nulla ut metus varius
|
|
||||||
laoreet. Curabitur ullamcorper ultricies nisi. Ut non enim eleifend felis pretium feugiat.
|
|
||||||
Donec mi odio, faucibus at, scelerisque quis, convallis in, nisi. Fusce vel dui. Quisque
|
|
||||||
libero metus, condimentum nec, tempor a, commodo mollis, magna. In enim justo, rhoncus ut,
|
|
||||||
imperdiet a, venenatis vitae, justo. Cras dapibus.
|
|
||||||
</Typography>
|
|
||||||
</Container>
|
|
||||||
</Page>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
@@ -38,18 +38,18 @@ export default function Router() {
|
|||||||
</AuthProvider>
|
</AuthProvider>
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
{
|
// {
|
||||||
path: 'register',
|
// path: 'register',
|
||||||
element: (
|
// element: (
|
||||||
<GuestGuard>
|
// <GuestGuard>
|
||||||
<RegisterForm />
|
// <RegisterForm />
|
||||||
</GuestGuard>
|
// </GuestGuard>
|
||||||
),
|
// ),
|
||||||
},
|
// },
|
||||||
{ path: 'login-unprotected', element: <Login /> },
|
// { path: 'login-unprotected', element: <Login /> },
|
||||||
{ path: 'register-unprotected', element: <Register /> },
|
// { path: 'register-unprotected', element: <Register /> },
|
||||||
{ path: 'reset-password', element: <ResetPassword /> },
|
// { path: 'reset-password', element: <ResetPassword /> },
|
||||||
{ path: 'verify', element: <VerifyCode /> },
|
// { path: 'verify', element: <VerifyCode /> },
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
// {
|
// {
|
||||||
@@ -66,7 +66,7 @@ export default function Router() {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: 'medicines/create',
|
path: 'medicines/create',
|
||||||
element: <AuthProvider><MedicinesCreate /></AuthProvider>
|
element: <MedicinesCreate />
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
@@ -105,14 +105,10 @@ export default function Router() {
|
|||||||
|
|
||||||
const Login = Loadable(lazy(() => import('../pages/auth/Login')));
|
const Login = Loadable(lazy(() => import('../pages/auth/Login')));
|
||||||
|
|
||||||
|
// Dashboard
|
||||||
|
const Dashboard = Loadable(lazy(() => import('../pages/Dashboard')));
|
||||||
|
const NotFound = Loadable(lazy(() => import('../pages/Page404')));
|
||||||
|
|
||||||
// Medicines
|
// Medicines
|
||||||
const Medicines = Loadable(lazy(() => import('../pages/Medicines/Index')));
|
const Medicines = Loadable(lazy(() => import('../pages/Medicines/Index')));
|
||||||
const MedicinesCreate = Loadable(lazy(() => import('../pages/Medicines/Create')));
|
const MedicinesCreate = Loadable(lazy(() => import('../pages/Medicines/Create')));
|
||||||
|
|
||||||
// Dashboard
|
|
||||||
const PageOne = Loadable(lazy(() => import('../pages/PageOne')));
|
|
||||||
const PageTwo = Loadable(lazy(() => import('../pages/PageTwo')));
|
|
||||||
const PageThree = Loadable(lazy(() => import('../pages/PageThree')));
|
|
||||||
const PageFour = Loadable(lazy(() => import('../pages/PageFour')));
|
|
||||||
const PageSix = Loadable(lazy(() => import('../pages/PageSix')));
|
|
||||||
const NotFound = Loadable(lazy(() => import('../pages/Page404')));
|
|
||||||
|
|||||||
Reference in New Issue
Block a user