updated code (started to) for new api, npm install is busted due to out of date deps I think, moving to different computer

This commit is contained in:
Solomon Laing 2021-06-06 12:07:29 +09:30
parent fd1df6e2af
commit 525e055d60
2 changed files with 5 additions and 24 deletions

View File

@ -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. * 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) { } constructor(private http: HttpClient, private router: Router) { }
@ -61,16 +61,7 @@ export class ProjectsService {
if (response) { if (response) {
// using text/plain so as to not get the preflight options request // 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. // as such : Project[] does not work as expected and objects must be parsed.
this.allProjects = [] this.allProjects = response;
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
});
}
// filter out different categories here currently only one // filter out different categories here currently only one
} }
}, },
@ -97,13 +88,4 @@ export class ProjectsService {
this.router.navigate(['not-found']) 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("-");
}
} }

View File

@ -1,7 +1,6 @@
export interface Project { export interface Project {
title: string,
description: string,
ct: string,
slug: string, slug: string,
body: string date: string,
category: string,
content: string
} }