From 61e4dfee1b171a97dadf09f6f30d04a2b9bde2f5 Mon Sep 17 00:00:00 2001 From: OudomMunint Date: Sun, 29 Oct 2023 00:39:51 +1100 Subject: [PATCH 1/3] API work --- API/API.js | 80 +++++++++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 67 insertions(+), 13 deletions(-) diff --git a/API/API.js b/API/API.js index 5a821071..daad104d 100644 --- a/API/API.js +++ b/API/API.js @@ -1,18 +1,72 @@ const API = { - // Get all proj - async getAllPosts() { - const response = await fetch( - "" - ); + // Get all posts + async getAllProjects() { + try { + const response = await fetch("https://jsonplaceholder.typicode.com/posts"); const data = await response.json(); return data; - }, - // Get proj via id - async getPostById(id) { - const response = await fetch( - `` - ); + } catch (error) { + console.error(error); + } + }, + + // Get post by ID + async getProjectById(id) { + try { + const response = await fetch(`https://jsonplaceholder.typicode.com/posts/${id}`); const data = await response.json(); return data; - }, - }; + } catch (error) { + console.error(error); + } + }, + + // Add new post + async addProject(post) { + try { + const response = await fetch("https://jsonplaceholder.typicode.com/posts", { + method: "POST", + body: JSON.stringify(post), + headers: { + "Content-type": "application/json; charset=UTF-8", + }, + }); + const data = await response.json(); + return data; + } catch (error) { + console.error(error); + } + }, + + // Update post by ID + async updateProjectById(id, post) { + try { + const response = await fetch(`https://jsonplaceholder.typicode.com/posts/${id}`, { + method: "PUT", + body: JSON.stringify(post), + headers: { + "Content-type": "application/json; charset=UTF-8", + }, + }); + const data = await response.json(); + return data; + } catch (error) { + console.error(error); + } + }, + + // Delete post by ID + async deleteProjectById(id) { + try { + const response = await fetch(`https://jsonplaceholder.typicode.com/posts/${id}`, { + method: "DELETE", + }); + const data = await response.json(); + return data; + } catch (error) { + console.error(error); + } + }, +}; + +export default API; \ No newline at end of file From a1b0f225dcd3b63b58f3a2292f1bde6b6bd0922c Mon Sep 17 00:00:00 2001 From: OudomMunint Date: Sun, 29 Oct 2023 00:43:38 +1100 Subject: [PATCH 2/3] Hid contribs for GHC --- Home.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Home.html b/Home.html index bb812699..2856dfe9 100755 --- a/Home.html +++ b/Home.html @@ -134,7 +134,7 @@

My GitHub contributions

- + From e0174636a2536e345622055c32427cc2a193e5c3 Mon Sep 17 00:00:00 2001 From: OudomMunint Date: Sun, 29 Oct 2023 01:01:21 +1100 Subject: [PATCH 3/3] Fix smooth scroll initial delay #27 --- css/all.min.css | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/css/all.min.css b/css/all.min.css index d3ad7775..e2d8a294 100644 --- a/css/all.min.css +++ b/css/all.min.css @@ -362,7 +362,6 @@ html { display: none; } html { - scroll-behavior: smooth !important; -webkit-font-smoothing: antialiased !important; } *, @@ -981,6 +980,7 @@ article:hover { border-radius: 20px; height: 630px; padding: 20px; + width: 350px; } .title { font-size: 36px;