fix: incorrect types now fixed
This commit is contained in:
@@ -47,8 +47,8 @@ export const useDataJson = (prefix: string) => {
|
|||||||
return data as Ref<T | null>;
|
return data as Ref<T | null>;
|
||||||
};
|
};
|
||||||
|
|
||||||
const getJsonData = async (collectionPrefix: string = 'content_data_') => {
|
const getJsonData = async <T = unknown>(collectionPrefix: string = 'content_data_') => {
|
||||||
return getData(collectionPrefix, { useFilter: true, extractMeta: true });
|
return getData<T>(collectionPrefix, { useFilter: true, extractMeta: true });
|
||||||
};
|
};
|
||||||
|
|
||||||
const getPageContent = async (collectionPrefix: string = 'content_', fallbackToEnglish: boolean = true) => {
|
const getPageContent = async (collectionPrefix: string = 'content_', fallbackToEnglish: boolean = true) => {
|
||||||
|
|||||||
@@ -35,13 +35,16 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
|
import { ResumeContent } from '~/types/resume';
|
||||||
|
|
||||||
useMeta({
|
useMeta({
|
||||||
title: $t('pages.resume.name'),
|
title: $t('pages.resume.name'),
|
||||||
description: $t('pages.resume.description'),
|
description: $t('pages.resume.description'),
|
||||||
});
|
});
|
||||||
const { getJsonData } = useDataJson('resume');
|
const { getJsonData } = useDataJson('resume');
|
||||||
const resumeContent = await getJsonData();
|
const resumeContent$ = await getJsonData<ResumeContent>();
|
||||||
const arrLength = (array?: T[]) => (array ? array.length - 1 : 0);
|
const resumeContent = computed(() => (resumeContent$.value ? resumeContent$.value : new ResumeContent()));
|
||||||
|
const arrLength = <T,>(array?: T[]) => (array ? array.length - 1 : 0);
|
||||||
const valueExp = computed(() => arrLength(resumeContent.value?.experience));
|
const valueExp = computed(() => arrLength(resumeContent.value?.experience));
|
||||||
const valueEd = computed(() => arrLength(resumeContent.value?.education));
|
const valueEd = computed(() => arrLength(resumeContent.value?.education));
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -1,13 +1,16 @@
|
|||||||
export interface ResumeExperience extends TimelineItem {
|
import type { TimelineItem } from '@nuxt/ui';
|
||||||
tools: string[];
|
|
||||||
|
export class ResumeExperience implements TimelineItem {
|
||||||
|
tools: string[] = [];
|
||||||
|
description?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ResumeContent {
|
export class ResumeContent {
|
||||||
experience: ResumeExperience[];
|
experience: ResumeExperience[] = [];
|
||||||
education: TimelineItem[];
|
education: TimelineItem[] = [];
|
||||||
otherTools: string[];
|
otherTools: string[] = [];
|
||||||
devops: string[];
|
devops: string[] = [];
|
||||||
os: string[];
|
os: string[] = [];
|
||||||
programmingLanguages: string[];
|
programmingLanguages: string[] = [];
|
||||||
frameworks: string[];
|
frameworks: string[] = [];
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user