-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add vue-router, new NavBar Component, Change path to request param, A…
…dd post functionality from UI
- Loading branch information
Showing
10 changed files
with
125 additions
and
12 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
<template lang=""> | ||
<div> | ||
<ul> | ||
<li><router-link to="/">Home</router-link></li> | ||
<li><router-link to="/bookmarks">Your Saved Bookmarks</router-link></li> | ||
</ul> | ||
<router-view></router-view> | ||
</div> | ||
</template> | ||
<script setup></script> | ||
<style> | ||
ul { | ||
position: sticky; | ||
top: 0; | ||
list-style-type: none; | ||
margin: 0; | ||
padding: 0; | ||
overflow: hidden; | ||
background-color: #333; | ||
} | ||
li { | ||
float: left; | ||
} | ||
li a { | ||
display: block; | ||
color: white; | ||
text-align: center; | ||
padding: 14px 16px; | ||
text-decoration: none; | ||
} | ||
/* Change the link color to #111 (black) on hover */ | ||
li a:hover { | ||
background-color: #111; | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
import { createApp } from "vue"; | ||
import App from "./App.vue"; | ||
import router from "./router/index"; | ||
|
||
createApp(App).mount("#app"); | ||
createApp(App).use(router).mount("#app"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import { createRouter, createWebHistory } from "vue-router"; | ||
import Home from "../views/Home.vue"; | ||
import BookmarkList from "../views/BookmarkList.vue"; | ||
|
||
const routes = [ | ||
{ path: "/", name: "Home", component: Home }, | ||
{ path: "/bookmarks", name: "BookmarkList", component: BookmarkList }, | ||
]; | ||
|
||
export const router = createRouter({ | ||
history: createWebHistory(), | ||
routes, | ||
}); | ||
|
||
export default router; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import axios, { Axios } from "axios"; | ||
|
||
const baseUrl = "http://localhost:8080"; | ||
const viewAllBookmarks = "/bookmarks"; | ||
const postBookmarkRelative = "/bookmark"; | ||
|
||
export function getBookmarks() { | ||
return axios.get(baseUrl.concat(viewAllBookmarks)).then((res) => res.data); | ||
} | ||
|
||
export function postBookmark(resource) { | ||
return axios | ||
.post(baseUrl.concat(postBookmarkRelative).concat("?url=").concat(resource)) | ||
.then((res) => res.data); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<template lang=""> | ||
<div> | ||
<label for="url">Enter your bookmark URL</label> | ||
<input | ||
type="text" | ||
v-model="url" | ||
name="url" | ||
id="" | ||
placeholder="Enter URL.." | ||
/> | ||
<button @click="submit">Go!</button> | ||
</div> | ||
</template> | ||
<script setup> | ||
import { postBookmark } from "../server_config/api"; | ||
import { ref } from "vue"; | ||
const url = ref(""); | ||
function submit() { | ||
postBookmark(url.value) | ||
.then((res) => console.log(res)) | ||
.catch((err) => console.log(err)); | ||
} | ||
</script> | ||
<style lang=""></style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters