diff --git a/starter-project-web-vue2/components/zerubabel/AddBlog.vue b/starter-project-web-vue2/components/zerubabel/AddBlog.vue new file mode 100644 index 00000000..975f9d55 --- /dev/null +++ b/starter-project-web-vue2/components/zerubabel/AddBlog.vue @@ -0,0 +1,73 @@ + + + diff --git a/starter-project-web-vue2/components/zerubabel/Blogs.vue b/starter-project-web-vue2/components/zerubabel/Blogs.vue new file mode 100644 index 00000000..6d4a89b3 --- /dev/null +++ b/starter-project-web-vue2/components/zerubabel/Blogs.vue @@ -0,0 +1,62 @@ + + + diff --git a/starter-project-web-vue2/components/zerubabel/EditBlog.vue b/starter-project-web-vue2/components/zerubabel/EditBlog.vue new file mode 100644 index 00000000..8fa85f08 --- /dev/null +++ b/starter-project-web-vue2/components/zerubabel/EditBlog.vue @@ -0,0 +1,71 @@ + + + diff --git a/starter-project-web-vue2/pages/index.vue b/starter-project-web-vue2/pages/index.vue index d20c3c5f..cfe0f344 100644 --- a/starter-project-web-vue2/pages/index.vue +++ b/starter-project-web-vue2/pages/index.vue @@ -77,6 +77,11 @@ export default { description: 'Group 32 Student', link: '/yared', }, + { + name: 'Zerubabel Kassahun', + description: 'Group 33 Student', + link: '/zerubabel', + }, ], } }, diff --git a/starter-project-web-vue2/pages/zerubabel/_id.vue b/starter-project-web-vue2/pages/zerubabel/_id.vue new file mode 100644 index 00000000..45050935 --- /dev/null +++ b/starter-project-web-vue2/pages/zerubabel/_id.vue @@ -0,0 +1,53 @@ + + + diff --git a/starter-project-web-vue2/pages/zerubabel/index.vue b/starter-project-web-vue2/pages/zerubabel/index.vue new file mode 100644 index 00000000..e92d29e5 --- /dev/null +++ b/starter-project-web-vue2/pages/zerubabel/index.vue @@ -0,0 +1,15 @@ + + + diff --git a/starter-project-web-vue2/pages/zerubabel/login.vue b/starter-project-web-vue2/pages/zerubabel/login.vue new file mode 100644 index 00000000..09a51266 --- /dev/null +++ b/starter-project-web-vue2/pages/zerubabel/login.vue @@ -0,0 +1,23 @@ + + + diff --git a/starter-project-web-vue2/pages/zerubabel/register.vue b/starter-project-web-vue2/pages/zerubabel/register.vue new file mode 100644 index 00000000..ef8a5d8e --- /dev/null +++ b/starter-project-web-vue2/pages/zerubabel/register.vue @@ -0,0 +1,25 @@ + + + diff --git a/starter-project-web-vue2/store/zerubabel.js b/starter-project-web-vue2/store/zerubabel.js new file mode 100644 index 00000000..7695b146 --- /dev/null +++ b/starter-project-web-vue2/store/zerubabel.js @@ -0,0 +1,162 @@ +const state = { + blogs: [ + { + _id: Math.floor(Math.random() * 1000), + title: 'The Big Bang Theory', + author: 'Zerubabel', + content: 'Something wonderful!', + description: + 'The Big Bang theory describes how the universe expanded from an initial state of high density and temperature.[1] It is the prevailing cosmological model explaining the evolution of the observable universe from the earliest known periods through its subsequent large-scale form.[2][3][4] The model offers a comprehensive explanation for a broad range of observed phenomena, including the abundance of light elements, the cosmic microwave background (CMB) radiation, and large-scale structure.', + createdAt: Date.now(), + }, + { + _id: Math.floor(Math.random() * 1000), + title: 'The Big Bang Theory', + author: 'Zerubabel', + content: 'Something wonderful!', + description: + 'The Big Bang theory describes how the universe expanded from an initial state of high density and temperature.[1] It is the prevailing cosmological model explaining the evolution of the observable universe from the earliest known periods through its subsequent large-scale form.[2][3][4] The model offers a comprehensive explanation for a broad range of observed phenomena, including the abundance of light elements, the cosmic microwave background (CMB) radiation, and large-scale structure.', + createdAt: Date.now(), + }, + { + _id: Math.floor(Math.random() * 1000), + title: 'The Big Bang Theory', + author: 'Zerubabel', + content: 'Something wonderful!', + description: + 'The Big Bang theory describes how the universe expanded from an initial state of high density and temperature.[1] It is the prevailing cosmological model explaining the evolution of the observable universe from the earliest known periods through its subsequent large-scale form.[2][3][4] The model offers a comprehensive explanation for a broad range of observed phenomena, including the abundance of light elements, the cosmic microwave background (CMB) radiation, and large-scale structure.', + createdAt: Date.now(), + }, + { + _id: Math.floor(Math.random() * 1000), + title: 'The Big Bang Theory', + author: 'Zerubabel', + content: 'Something wonderful!', + description: + 'The Big Bang theory describes how the universe expanded from an initial state of high density and temperature.[1] It is the prevailing cosmological model explaining the evolution of the observable universe from the earliest known periods through its subsequent large-scale form.[2][3][4] The model offers a comprehensive explanation for a broad range of observed phenomena, including the abundance of light elements, the cosmic microwave background (CMB) radiation, and large-scale structure.', + createdAt: Date.now(), + }, + { + _id: Math.floor(Math.random() * 1000), + title: 'The Big Bang Theory', + author: 'Zerubabel', + content: 'Something wonderful!', + description: + 'The Big Bang theory describes how the universe expanded from an initial state of high density and temperature.[1] It is the prevailing cosmological model explaining the evolution of the observable universe from the earliest known periods through its subsequent large-scale form.[2][3][4] The model offers a comprehensive explanation for a broad range of observed phenomena, including the abundance of light elements, the cosmic microwave background (CMB) radiation, and large-scale structure.', + createdAt: Date.now(), + }, + { + _id: Math.floor(Math.random() * 1000), + title: 'The Big Bang Theory', + author: 'Zerubabel', + content: 'Something wonderful!', + description: + 'The Big Bang theory describes how the universe expanded from an initial state of high density and temperature.[1] It is the prevailing cosmological model explaining the evolution of the observable universe from the earliest known periods through its subsequent large-scale form.[2][3][4] The model offers a comprehensive explanation for a broad range of observed phenomena, including the abundance of light elements, the cosmic microwave background (CMB) radiation, and large-scale structure.', + createdAt: Date.now(), + }, + { + _id: Math.floor(Math.random() * 1000), + title: 'The Big Bang Theory', + author: 'Zerubabel', + content: 'Something wonderful!', + description: + 'The Big Bang theory describes how the universe expanded from an initial state of high density and temperature.[1] It is the prevailing cosmological model explaining the evolution of the observable universe from the earliest known periods through its subsequent large-scale form.[2][3][4] The model offers a comprehensive explanation for a broad range of observed phenomena, including the abundance of light elements, the cosmic microwave background (CMB) radiation, and large-scale structure.', + createdAt: Date.now(), + }, + { + _id: Math.floor(Math.random() * 1000), + title: 'The Big Bang Theory', + author: 'Zerubabel', + content: 'Something wonderful!', + description: + 'The Big Bang theory describes how the universe expanded from an initial state of high density and temperature.[1] It is the prevailing cosmological model explaining the evolution of the observable universe from the earliest known periods through its subsequent large-scale form.[2][3][4] The model offers a comprehensive explanation for a broad range of observed phenomena, including the abundance of light elements, the cosmic microwave background (CMB) radiation, and large-scale structure.', + createdAt: Date.now(), + }, + { + _id: Math.floor(Math.random() * 1000), + title: 'The Big Bang Theory', + author: 'Zerubabel', + content: 'Something wonderful!', + description: + 'The Big Bang theory describes how the universe expanded from an initial state of high density and temperature.[1] It is the prevailing cosmological model explaining the evolution of the observable universe from the earliest known periods through its subsequent large-scale form.[2][3][4] The model offers a comprehensive explanation for a broad range of observed phenomena, including the abundance of light elements, the cosmic microwave background (CMB) radiation, and large-scale structure.', + createdAt: Date.now(), + }, + { + _id: Math.floor(Math.random() * 1000), + title: 'The Big Bang Theory', + author: 'Zerubabel', + content: 'Something wonderful!', + description: + 'The Big Bang theory describes how the universe expanded from an initial state of high density and temperature.[1] It is the prevailing cosmological model explaining the evolution of the observable universe from the earliest known periods through its subsequent large-scale form.[2][3][4] The model offers a comprehensive explanation for a broad range of observed phenomena, including the abundance of light elements, the cosmic microwave background (CMB) radiation, and large-scale structure.', + createdAt: Date.now(), + }, + { + _id: Math.floor(Math.random() * 1000), + title: 'The Big Bang Theory', + author: 'Zerubabel', + content: 'Something wonderful!', + description: + 'The Big Bang theory describes how the universe expanded from an initial state of high density and temperature.[1] It is the prevailing cosmological model explaining the evolution of the observable universe from the earliest known periods through its subsequent large-scale form.[2][3][4] The model offers a comprehensive explanation for a broad range of observed phenomena, including the abundance of light elements, the cosmic microwave background (CMB) radiation, and large-scale structure.', + createdAt: Date.now(), + }, + { + _id: Math.floor(Math.random() * 1000), + title: 'The Big Bang Theory', + author: 'Zerubabel', + content: 'Something wonderful!', + description: + 'The Big Bang theory describes how the universe expanded from an initial state of high density and temperature.[1] It is the prevailing cosmological model explaining the evolution of the observable universe from the earliest known periods through its subsequent large-scale form.[2][3][4] The model offers a comprehensive explanation for a broad range of observed phenomena, including the abundance of light elements, the cosmic microwave background (CMB) radiation, and large-scale structure.', + createdAt: Date.now(), + }, + { + _id: Math.floor(Math.random() * 1000), + title: 'The Big Bang Theory', + author: 'Zerubabel', + content: 'Something wonderful!', + description: + 'The Big Bang theory describes how the universe expanded from an initial state of high density and temperature.[1] It is the prevailing cosmological model explaining the evolution of the observable universe from the earliest known periods through its subsequent large-scale form.[2][3][4] The model offers a comprehensive explanation for a broad range of observed phenomena, including the abundance of light elements, the cosmic microwave background (CMB) radiation, and large-scale structure.', + createdAt: Date.now(), + }, + ], + user: null, +} + +const getters = { + allBlogs: (state) => state.blogs, +} +const actions = { + addBlog({ commit }, data) { + commit('addBlog', data) + }, + deleteBlog({ commit }, id) { + commit('deleteBlog', id) + }, + editBlog({ commit }, data) { + commit('editBlog', data) + }, +} +const mutations = { + setBlogs(state, blogs) { + state.blogs = blogs + }, + addBlog(state, blog) { + state.blogs.unshift(blog) + }, + deleteBlog(state, id) { + state.blogs = state.blogs.filter((blog) => blog._id !== id) + }, + editBlog(state, data) { + for (let i = 0; i < state.blogs.length; i++) { + if (state.blogs[i]._id === data._id) { + state.blogs.splice(i, 1, data) + } + } + }, +} + +export default { + state, + getters, + actions, + mutations, +}