group TS interfaces to avoid redundancy
This commit is contained in:
@@ -1,24 +1,5 @@
|
||||
import { createContext } from "react";
|
||||
|
||||
|
||||
export interface Task {
|
||||
id: number;
|
||||
title?: string;
|
||||
completed?: boolean;
|
||||
[key: string]: unknown;
|
||||
}
|
||||
|
||||
export interface User {
|
||||
id: number
|
||||
name: string;
|
||||
lastname: string;
|
||||
role: string;
|
||||
email: string;
|
||||
phone: string | null;
|
||||
created_at: string;
|
||||
profile_photo_path?: string | null;
|
||||
tasks: Task[];
|
||||
}
|
||||
import User from "./../../interfaces/user.interface"
|
||||
|
||||
export interface AuthContextType {
|
||||
user: User | null;
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
|
||||
import type User from "./user.interface";
|
||||
export interface AuthContextType {
|
||||
user: User | null;
|
||||
update: () => void;
|
||||
}
|
||||
@@ -14,3 +14,9 @@ export default interface TaskType {
|
||||
task_id: number;
|
||||
};
|
||||
}
|
||||
export default interface Task {
|
||||
id: number;
|
||||
title?: string;
|
||||
completed?: boolean;
|
||||
[key: string]: unknown;
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
import TaskType from "./taskType.interface";
|
||||
import TaskType from "./task.interface";
|
||||
|
||||
export default interface User {
|
||||
id: number;
|
||||
|
||||
@@ -7,46 +7,15 @@ import SettingsModal from "./components/SettingsModal/SettingsModal";
|
||||
import {useParams} from "react-router";
|
||||
import {useNavigate} from "react-router";
|
||||
import {useRef} from "react";
|
||||
import getUserById from "../../utils/users/getUserById";
|
||||
import ManageMember from "./components/ManageMember/ManageMember.js";
|
||||
import getUserById from "../../utils/users/getUserById.js";
|
||||
import ManageMember from "./components/ManageMember/ManageMember";
|
||||
import uploadProfilePhoto from "../../utils/users/uploadProfilePhoto";
|
||||
import deleteProfilePhoto from "../../utils/users/deleteProfilePhoto.js";
|
||||
|
||||
interface TaskType {
|
||||
id: number;
|
||||
name: string;
|
||||
description: string;
|
||||
location: string;
|
||||
start: string;
|
||||
end: string;
|
||||
max_participants: number;
|
||||
events_id: number;
|
||||
created_at: string;
|
||||
updated_at: string;
|
||||
pivot: {
|
||||
user_id: number;
|
||||
task_id: number;
|
||||
};
|
||||
}
|
||||
import deleteProfilePhoto from "../../utils/users/deleteProfilePhoto";
|
||||
import type { AuthContextType } from "../../interfaces/AuthInterfaces";
|
||||
import type TaskType from "../../interfaces/task.interface";
|
||||
import type User from "../../interfaces/user.interface";
|
||||
|
||||
|
||||
interface User {
|
||||
id: number;
|
||||
name: string;
|
||||
lastname: string;
|
||||
role: string;
|
||||
email: string;
|
||||
phone: string | null;
|
||||
created_at: string;
|
||||
isAdmin: boolean;
|
||||
tasks: TaskType[];
|
||||
profile_photo_path?: string | null;
|
||||
}
|
||||
|
||||
interface AuthContextType {
|
||||
user: User | null;
|
||||
update: () => void;
|
||||
}
|
||||
|
||||
function ProfilePage() {
|
||||
const navigate = useNavigate();
|
||||
|
||||
Reference in New Issue
Block a user