Skip to content

Commit

Permalink
refactor: move types and interfaces to a different folder
Browse files Browse the repository at this point in the history
  • Loading branch information
Prajwalism committed Jul 8, 2024
1 parent 238e992 commit 9f099dd
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 22 deletions.
10 changes: 1 addition & 9 deletions src/frontend/src/components/GoogleAuth/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,7 @@ import { useEffect, useState } from 'react';
import { useLocation, useNavigate } from 'react-router-dom';
import { Flex } from '@Components/common/Layouts';
import { toast } from 'react-toastify';

export interface UserProfileDetailsType {
id: string;
email: string;
img_url: string;
has_user_profile: boolean;
}

export type IUserProfileDetailsType = UserProfileDetailsType | null;
import { UserProfileDetailsType } from './types';

const { BASE_URL } = process.env;

Expand Down
8 changes: 8 additions & 0 deletions src/frontend/src/components/GoogleAuth/types/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
export interface UserProfileDetailsType {
id: string;
email: string;
img_url: string;
has_user_profile: boolean;
}

export type IUserProfileDetailsType = UserProfileDetailsType | null;
Original file line number Diff line number Diff line change
@@ -1,20 +1,10 @@
import { Flex, FlexColumn } from '@Components/common/Layouts';
import {
FormControl,
FormGroup,
Input,
Label,
Select,
} from '@Components/common/FormUI';
import { UserProfileDetailsType } from '@Components/GoogleAuth';
import { useForm } from 'react-hook-form';
import { FormControl, Input, Label } from '@Components/common/FormUI';
import ErrorMessage from '@Components/common/ErrorMessage';

export default function BasicDetails({ formProps }: { formProps: any }) {
const { register } = formProps;

console.log(formProps.formState.errors, 'formProps.formState.errors');

// const userProfile: UserProfileDetailsType =
// localStorage.getItem('userprofile');
return (
Expand Down
2 changes: 1 addition & 1 deletion src/frontend/src/services/common.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { UserProfileDetailsType } from '@Components/GoogleAuth';
import { UserProfileDetailsType } from '@Components/GoogleAuth/types';
import { api } from '.';

export const signInUser = (data: any) => api.post('/users/login/', data);
Expand Down
2 changes: 1 addition & 1 deletion src/frontend/src/views/UserProfile/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {
} from '@Components/UserProfile/FormContents';
import { useMutation } from '@tanstack/react-query';
import { postUserProfile } from '@Services/common';
import { IUserProfileDetailsType } from '@Components/GoogleAuth';
import { IUserProfileDetailsType } from '@Components/GoogleAuth/types';
import Tab from './UserProfileTabs';

const getActiveFormContent = (activeTab: number, formProps: any) => {
Expand Down

0 comments on commit 9f099dd

Please sign in to comment.