diff --git a/client/components/build/LeftSidebar/sections/Section.tsx b/client/components/build/LeftSidebar/sections/Section.tsx index ec2ce615..0a3fd62d 100644 --- a/client/components/build/LeftSidebar/sections/Section.tsx +++ b/client/components/build/LeftSidebar/sections/Section.tsx @@ -41,14 +41,14 @@ const Section: React.FC = ({ const visibility = useAppSelector((state) => get(state.resume, `${path}.visible`, true)); const handleAdd = () => { - const id = path ? (path.split('.').at(-1) as string) : ''; + const id = path.split('.')[1]; const modal: ModalName = validate(id) ? 'builder.sections.custom' : `builder.${path}`; dispatch(setModalState({ modal, state: { open: true, payload: { path } } })); }; const handleEdit = (item: ListItem) => { - const id = path ? (path.split('.').at(-1) as string) : ''; + const id = path.split('.')[1]; const modal: ModalName = validate(id) ? 'builder.sections.custom' : `builder.${path}`; const payload = validate(id) ? { path, item } : { item }; diff --git a/client/components/shared/Heading.tsx b/client/components/shared/Heading.tsx index 311f4cfa..12248696 100644 --- a/client/components/shared/Heading.tsx +++ b/client/components/shared/Heading.tsx @@ -37,7 +37,7 @@ const Heading: React.FC = ({ const [editMode, setEditMode] = useState(false); - const id = useMemo(() => (path ? path.split('.').at(-1) : ''), [path]); + const id = useMemo(() => path.split('.')[1], [path]); const icon = sections.find((x) => x.id === id)?.icon || ; diff --git a/client/store/resume/resumeSlice.ts b/client/store/resume/resumeSlice.ts index a369a2db..6cb3b78d 100644 --- a/client/store/resume/resumeSlice.ts +++ b/client/store/resume/resumeSlice.ts @@ -82,7 +82,7 @@ export const resumeSlice = createSlice({ }, deleteSection: (state: Resume, action: PayloadAction) => { const { path } = action.payload; - const id = path ? path.split('.').at(-1) : ''; + const id = path.split('.')[1]; const sections = Object.keys(state.sections).filter((x) => x !== id); const layout = state.metadata.layout.map((pages) => pages.map((list) => list.filter((x) => x !== id))); diff --git a/client/utils/getCookie.ts b/client/utils/getCookie.ts index a3c3be21..4c189109 100644 --- a/client/utils/getCookie.ts +++ b/client/utils/getCookie.ts @@ -3,6 +3,6 @@ export const getCookie = (name: string): string | undefined => { const parts = value.split(`; ${name}=`); if (parts.length === 2) { - return parts.at(-1); + return parts[1]; } }; diff --git a/server/src/auth/auth.service.ts b/server/src/auth/auth.service.ts index 14be3758..9961f6c6 100644 --- a/server/src/auth/auth.service.ts +++ b/server/src/auth/auth.service.ts @@ -129,7 +129,7 @@ export class AuthService { const UserInfoClient = google.oauth2('v2').userinfo; const { data } = await UserInfoClient.get({ auth: OAuthClient }); - const username = data.email.split('@').at(0); + const username = data.email.split('@')[0]; const createUserDto: CreateGoogleUserDto = { name: `${data.given_name} ${data.family_name}`,