From e060ab4dea6270de7681fc0b7f51fec4dd4d79d3 Mon Sep 17 00:00:00 2001 From: Oliver Booth Date: Fri, 11 Aug 2023 16:31:18 +0100 Subject: [PATCH] fix: use string for entity uuid --- src/ts/API.ts | 2 +- src/ts/BlogPost.ts | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/ts/API.ts b/src/ts/API.ts index 34fe267..fdf81d0 100644 --- a/src/ts/API.ts +++ b/src/ts/API.ts @@ -17,7 +17,7 @@ class API { return JSON.parse(text).map(obj => new BlogPost(obj)); } - static async getAuthor(id: number): Promise { + static async getAuthor(id: string): Promise { const response = await fetch(`${API.BASE_URL + API.BLOG_URL}/author/${id}`); const text = await response.text(); return new Author(JSON.parse(text)); diff --git a/src/ts/BlogPost.ts b/src/ts/BlogPost.ts index 7951444..7f493b3 100644 --- a/src/ts/BlogPost.ts +++ b/src/ts/BlogPost.ts @@ -1,9 +1,9 @@ class BlogPost { - private readonly _id: number; + private readonly _id: string; private readonly _commentsEnabled: boolean; private readonly _title: string; private readonly _excerpt: string; - private readonly _authorId: number; + private readonly _authorId: string; private readonly _published: Date; private readonly _updated?: Date; private readonly _url: string; @@ -17,7 +17,7 @@ class BlogPost { this._commentsEnabled = json.commentsEnabled; this._title = json.title; this._excerpt = json.excerpt; - this._authorId = parseInt(json.author); + this._authorId = json.author; this._published = new Date(json.published * 1000); this._updated = (json.updated && new Date(json.updated * 1000)) || null; this._url = json.url; @@ -27,7 +27,7 @@ class BlogPost { this._formattedDate = json.formattedDate; } - get id(): number { + get id(): string { return this._id; } @@ -43,7 +43,7 @@ class BlogPost { return this._excerpt; } - get authorId(): number { + get authorId(): string { return this._authorId; }