From 5d754396da0c4e79ced37356da7b3a637f061e25 Mon Sep 17 00:00:00 2001 From: Solomon Laing Date: Sun, 6 Jun 2021 12:07:29 +0930 Subject: [PATCH] updated code (started to) for new api, npm install is busted due to out of date deps I think, moving to different computer --- src/app/projects/projects.service.ts | 22 ++-------------------- src/app/shared/models/project.model.ts | 7 +++---- 2 files changed, 5 insertions(+), 24 deletions(-) diff --git a/src/app/projects/projects.service.ts b/src/app/projects/projects.service.ts index fa29dfb..c77cffc 100644 --- a/src/app/projects/projects.service.ts +++ b/src/app/projects/projects.service.ts @@ -43,7 +43,7 @@ export class ProjectsService { * I am actively avoiding any kind of environment management, this is a very basic site and currently this is the only api call. */ - private PROJECT_API_URL = "https://cms.inkletblot.com/api/json" + private PROJECT_API_URL = "https://cms.inkletblot.com/" constructor(private http: HttpClient, private router: Router) { } @@ -61,16 +61,7 @@ export class ProjectsService { if (response) { // using text/plain so as to not get the preflight options request // as such : Project[] does not work as expected and objects must be parsed. - this.allProjects = [] - for (let project of response) { - this.allProjects.push({ - title : project.title, - description : project.description, - ct : project.ct, - slug : this.generateSlug(project.title), - body : project.body - }); - } + this.allProjects = response; // filter out different categories here currently only one } }, @@ -97,13 +88,4 @@ export class ProjectsService { this.router.navigate(['not-found']) } } - - /** - * Currently this is very basic and assumes that generated slug will be unique, it may be updated in future. - * @param input string to use for generating the slug - * @returns a slug representation of the input string - */ - generateSlug(input: string): string { - return input.toLocaleLowerCase().split(" ").join("-"); - } } diff --git a/src/app/shared/models/project.model.ts b/src/app/shared/models/project.model.ts index 28dec90..196064d 100644 --- a/src/app/shared/models/project.model.ts +++ b/src/app/shared/models/project.model.ts @@ -1,7 +1,6 @@ export interface Project { - title: string, - description: string, - ct: string, slug: string, - body: string + date: string, + category: string, + content: string } \ No newline at end of file