group TS interfaces to avoid redundancy
This commit is contained in:
@@ -1,24 +1,5 @@
|
|||||||
import { createContext } from "react";
|
import { createContext } from "react";
|
||||||
|
import User from "./../../interfaces/user.interface"
|
||||||
|
|
||||||
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[];
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface AuthContextType {
|
export interface AuthContextType {
|
||||||
user: User | null;
|
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;
|
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 {
|
export default interface User {
|
||||||
id: number;
|
id: number;
|
||||||
|
|||||||
@@ -7,46 +7,15 @@ import SettingsModal from "./components/SettingsModal/SettingsModal";
|
|||||||
import {useParams} from "react-router";
|
import {useParams} from "react-router";
|
||||||
import {useNavigate} from "react-router";
|
import {useNavigate} from "react-router";
|
||||||
import {useRef} from "react";
|
import {useRef} from "react";
|
||||||
import getUserById from "../../utils/users/getUserById";
|
import getUserById from "../../utils/users/getUserById.js";
|
||||||
import ManageMember from "./components/ManageMember/ManageMember.js";
|
import ManageMember from "./components/ManageMember/ManageMember";
|
||||||
import uploadProfilePhoto from "../../utils/users/uploadProfilePhoto";
|
import uploadProfilePhoto from "../../utils/users/uploadProfilePhoto";
|
||||||
import deleteProfilePhoto from "../../utils/users/deleteProfilePhoto.js";
|
import deleteProfilePhoto from "../../utils/users/deleteProfilePhoto";
|
||||||
|
import type { AuthContextType } from "../../interfaces/AuthInterfaces";
|
||||||
interface TaskType {
|
import type TaskType from "../../interfaces/task.interface";
|
||||||
id: number;
|
import type User from "../../interfaces/user.interface";
|
||||||
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;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
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() {
|
function ProfilePage() {
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
|
|||||||
Reference in New Issue
Block a user