diff --git a/frontend/svelte/src/models/StrapiNoteRepository.ts b/frontend/svelte/src/models/StrapiNoteRepository.ts index 22c4a16..760edbd 100644 --- a/frontend/svelte/src/models/StrapiNoteRepository.ts +++ b/frontend/svelte/src/models/StrapiNoteRepository.ts @@ -19,12 +19,12 @@ export class StrapiNoteRepository implements NoteRepository { private static apiNoteEndpoint: string = "http://localhost:1337/api/notes" public async getNotes(): Promise{ - const response = await StrapiNoteRepository.fetchStrapi("/", 'GET'); + const response = await StrapiNoteRepository.fetchStrapiNoteEndpoint("/", 'GET'); return await response.json(); } public async getNote(id: number): Promise{ - const response = await StrapiNoteRepository.fetchStrapi("/" + id, 'GET'); + const response = await StrapiNoteRepository.fetchStrapiNoteEndpoint("/" + id, 'GET'); return await response.json(); } @@ -36,20 +36,20 @@ export class StrapiNoteRepository implements NoteRepository { } public async updateNote(id: number, note: Partial): Promise { - const response = await StrapiNoteRepository.fetchStrapi("/" + id, 'PUT', note); + const response = await StrapiNoteRepository.fetchStrapiNoteEndpoint("/" + id, 'PUT', note); return await response.json(); } public async createNote(note: Partial & Pick): Promise { - const response = await StrapiNoteRepository.fetchStrapi("/", 'POST', note); + const response = await StrapiNoteRepository.fetchStrapiNoteEndpoint("/", 'POST', note); return await response.json(); } public async deleteNote(id: number): Promise { - await StrapiNoteRepository.fetchStrapi("/" + id, 'DELETE'); + await StrapiNoteRepository.fetchStrapiNoteEndpoint("/" + id, 'DELETE'); } - private static async fetchStrapi(path: string, method: HttpMethod, body: Partial | null = null): Promise { + private static async fetchStrapiNoteEndpoint(path: string, method: HttpMethod, body: Partial | null = null): Promise { let requestInit: RequestInit = { method: method, headers: { diff --git a/frontend/svelte/src/models/types.ts b/frontend/svelte/src/models/types.ts index 5ded795..0b0e8aa 100644 --- a/frontend/svelte/src/models/types.ts +++ b/frontend/svelte/src/models/types.ts @@ -1,11 +1,6 @@ export interface Note { id: number; - attributes: Attribute; -} - -export interface Attribute { title: string; content: string; - lastViewed: Date; } \ No newline at end of file