[m
-
[m
-[1mdiff --git a/apps/platform/src/app/(main)/project/[project]/layout.tsx b/apps/platform/src/app/(main)/project/[project]/layout.tsx[m
-[1mindex 1eb511b..9edfb0b 100644[m
-[1m--- a/apps/platform/src/app/(main)/project/[project]/layout.tsx[m
-[1m+++ b/apps/platform/src/app/(main)/project/[project]/layout.tsx[m
-[36m@@ -2,6 +2,7 @@[m
- import { useEffect, useState } from 'react'[m
- import { useSearchParams } from 'next/navigation'[m
- import { AddSVG } from '@public/svg/shared'[m
-[32m+[m[32mimport type { Project } from '@keyshade/schema'[m
- import { Button } from '@/components/ui/button'[m
- import {[m
- Dialog,[m
-[36m@@ -13,8 +14,7 @@[m [mimport {[m
- } from '@/components/ui/dialog'[m
- import { Input } from '@/components/ui/input'[m
- import { Label } from '@/components/ui/label'[m
-[31m-import { ProjectController } from '@keyshade/api-client'[m
-[31m-import type { Project } from '@keyshade/schema'[m
-[32m+[m[32mimport ControllerInstance from '@/lib/controller-instance'[m
- [m
- interface DetailedProjectPageProps {[m
- params: { project: string }[m
-[36m@@ -38,29 +38,22 @@[m [mfunction DetailedProjectPage({[m
- const tab = searchParams.get('tab') ?? 'rollup-details'[m
- [m
- useEffect(() => {[m
-[32m+[m[32m async function getProjectBySlug() {[m
-[32m+[m[32m const { success, error, data } =[m
-[32m+[m[32m await ControllerInstance.getInstance().projectController.getProject([m
-[32m+[m[32m { projectSlug: params.project },[m
-[32m+[m[32m {}[m
-[32m+[m[32m )[m
- [m
-[31m- const projectController = new ProjectController([m
-[31m- process.env.NEXT_PUBLIC_BACKEND_URL[m
-[31m- )[m
-[31m-[m
-[31m- async function getProjectBySlug(){[m
-[31m- const {success, error, data} = await projectController.getProject([m
-[31m- {projectSlug: params.project},[m
-[31m- {}[m
-[31m- )[m
-[31m-[m
-[31m- if( success && data ){[m
-[31m- //@ts-ignore[m
-[32m+[m[32m if (success && data) {[m
- setCurrentProject(data)[m
-[31m- }[m
-[31m- else{[m
-[32m+[m[32m } else {[m
- // eslint-disable-next-line no-console -- we need to log the error[m
- console.error(error)[m
- }[m
- }[m
- [m
- getProjectBySlug()[m
-[31m-[m
- }, [params.project])[m
- [m
- return ([m
-[1mdiff --git a/apps/platform/src/app/(main)/settings/@profile/page.tsx b/apps/platform/src/app/(main)/settings/@profile/page.tsx[m
-[1mindex 21de60b..4559ec6 100644[m
-[1m--- a/apps/platform/src/app/(main)/settings/@profile/page.tsx[m
-[1m+++ b/apps/platform/src/app/(main)/settings/@profile/page.tsx[m
-[36m@@ -1,54 +1,52 @@[m
- 'use client'[m
-[31m-import React, { useEffect, useState } from 'react'[m
-[32m+[m[32mimport React, { useCallback, useEffect, useState } from 'react'[m
- import { toast } from 'sonner'[m
-[31m-import type { User } from '@keyshade/schema'[m
- import InputLoading from './loading'[m
- import { Input } from '@/components/ui/input'[m
- import { Separator } from '@/components/ui/separator'[m
-[32m+[m[32mimport ControllerInstance from '@/lib/controller-instance'[m
- import { Button } from '@/components/ui/button'[m
-[31m-import { apiClient } from '@/lib/api-client'[m
-[31m-[m
-[31m-type UserData = Omit<[m
-[31m- User,[m
-[31m- 'id' | 'isActive' | 'isOnboardingFinished' | 'isAdmin' | 'authProvider'[m
-[31m->[m
-[31m-async function getUserDetails(): Promise {[m
-[31m- try {[m
-[31m- return await apiClient.get('/user')[m
-[31m- } catch (error) {[m
-[31m- // eslint-disable-next-line no-console -- we need to log the error[m
-[31m- console.error(error)[m
-[31m- }[m
-[31m-}[m
-[31m-[m
-[31m-async function updateUserDetails(userData: UserData): Promise {[m
-[31m- try {[m
-[31m- await apiClient.put('/user', userData)[m
-[31m- } catch (error) {[m
-[31m- // eslint-disable-next-line no-console -- we need to log the error[m
-[31m- console.error(error)[m
-[31m- }[m
-[31m-}[m
- [m
- function ProfilePage(): React.JSX.Element {[m
- const [isLoading, setIsLoading] = useState(true)[m
-[31m- const [userData, setUserData] = useState({[m
-[32m+[m[32m const [userData, setUserData] = useState({[m
- email: '',[m
- name: '',[m
- profilePictureUrl: ''[m
- })[m
- const [isModified, setIsModified] = useState(false)[m
- [m
-[32m+[m[32m const updateSelf = useCallback(async () => {[m
-[32m+[m[32m try {[m
-[32m+[m[32m await ControllerInstance.getInstance().userController.updateSelf([m
-[32m+[m[32m {[m
-[32m+[m[32m name: userData.name,[m
-[32m+[m[32m email: userData.email[m
-[32m+[m[32m },[m
-[32m+[m[32m {}[m
-[32m+[m[32m )[m
-[32m+[m[32m toast.success('Profile updated successfully')[m
-[32m+[m[32m } catch (error) {[m
-[32m+[m[32m // eslint-disable-next-line no-console -- we need to log the error[m
-[32m+[m[32m console.error(error)[m
-[32m+[m[32m }[m
-[32m+[m[32m setIsModified(false)[m
-[32m+[m[32m }, [userData])[m
-[32m+[m
- useEffect(() => {[m
-[31m- getUserDetails()[m
-[31m- .then((data) => {[m
-[31m- if (data) {[m
-[32m+[m[32m ControllerInstance.getInstance()[m
-[32m+[m[32m .userController.getSelf()[m
-[32m+[m[32m .then(({ data, success, error }) => {[m
-[32m+[m[32m if (success && data) {[m
- setUserData({[m
- email: data.email,[m
-[31m- name: data.name ?? '',[m
-[31m- profilePictureUrl: data.profilePictureUrl[m
-[32m+[m[32m name: data.name,[m
-[32m+[m[32m profilePictureUrl: data.profilePictureUrl || ''[m
- })[m
- setIsLoading(false)[m
-[32m+[m[32m } else {[m
-[32m+[m[32m // eslint-disable-next-line no-console -- we need to log the error[m
-[32m+[m[32m console.error(error)[m
- }[m
- })[m
- .catch((error) => {[m
-[36m@@ -67,7 +65,7 @@[m [mfunction ProfilePage(): React.JSX.Element {[m
- Upload a picture to change your avatar across Keyshade.[m
- [m
-
[m
-[31m-
{' '}[m
-[32m+[m[32m
[m
- {/* //! This is will be replaced by an image tag */}[m
-
[m
- {/* Name */}[m
-[36m@@ -114,20 +112,7 @@[m [mfunction ProfilePage(): React.JSX.Element {[m
- )}[m
-