Compare commits
No commits in common. "1da94c5211daa394dbaa7ca9e1edb2c20b1ea08e" and "0b86ed9254d3c2e6d6d97970bcbc8a2e5046c376" have entirely different histories.
1da94c5211
...
0b86ed9254
|
|
@ -5,8 +5,8 @@
|
||||||
"dev": "vite",
|
"dev": "vite",
|
||||||
"build": "vue-tsc --noEmit && vite build",
|
"build": "vue-tsc --noEmit && vite build",
|
||||||
"serve": "vite preview",
|
"serve": "vite preview",
|
||||||
"lint": "eslint --ext .js,.vue src",
|
"lint": "eslint \"src/**\"",
|
||||||
"format": "yarn run lint --fix"
|
"format": "eslint --fix \"src/**\""
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"vue": "^3.0.5",
|
"vue": "^3.0.5",
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,6 @@
|
||||||
<template>
|
<template>
|
||||||
<div>
|
<Nav />
|
||||||
<Nav />
|
<router-view />
|
||||||
<router-view />
|
|
||||||
</div>
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
|
|
|
||||||
|
|
@ -3,11 +3,11 @@ export interface Street {
|
||||||
city: string
|
city: string
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function search (searchTerm: string): Promise<Street[]> {
|
export async function search (search_term: string): Promise<Street[]> {
|
||||||
const baseURL = import.meta.env.VITE_ENDPOINT as string
|
const base_url = import.meta.env.VITE_ENDPOINT as string
|
||||||
|
|
||||||
const r = await fetch(`${baseURL}/ivago/search?` + new URLSearchParams({
|
const r = await fetch(`${base_url}/ivago/search?` + new URLSearchParams({
|
||||||
q: searchTerm
|
q: search_term
|
||||||
}))
|
}))
|
||||||
|
|
||||||
if (!r.ok) {
|
if (!r.ok) {
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,51 @@
|
||||||
|
<template>
|
||||||
|
<h1>Fej Frontend</h1>
|
||||||
|
|
||||||
|
<input id="street" type="text" placeholder="street" v-model="street" />
|
||||||
|
<button :onClick="onSubmit">Search</button>
|
||||||
|
|
||||||
|
<ul>
|
||||||
|
<li v-for="res in results">{{res.name}} ({{res.city}})</li>
|
||||||
|
</ul>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script lang="ts">
|
||||||
|
import { defineComponent } from 'vue'
|
||||||
|
import { Street, Ivago } from '../api/ivago'
|
||||||
|
|
||||||
|
export default defineComponent({
|
||||||
|
name: 'HelloWorld',
|
||||||
|
data () {
|
||||||
|
return {
|
||||||
|
street: '',
|
||||||
|
results: [] as Street[]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
onSubmit () {
|
||||||
|
new Ivago(import.meta.env.VITE_ENDPOINT as string).search(this.$data.street)
|
||||||
|
.then(res => {
|
||||||
|
this.$data.results = res
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
a {
|
||||||
|
color: #42b983;
|
||||||
|
}
|
||||||
|
|
||||||
|
label {
|
||||||
|
margin: 0 0.5em;
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
|
||||||
|
code {
|
||||||
|
background-color: #eee;
|
||||||
|
padding: 2px 4px;
|
||||||
|
border-radius: 4px;
|
||||||
|
color: #304455;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
@ -1,9 +1,7 @@
|
||||||
<template>
|
<template>
|
||||||
<div>
|
<h1>Fej</h1>
|
||||||
<h1>Fej</h1>
|
<p>Welcome to Fej, my frontend/backend combo.</p>
|
||||||
<p>Welcome to Fej, my frontend/backend combo.</p>
|
<p>If you can see this, the cicd worked!</p>
|
||||||
<p>If you can see this, the cicd worked!</p>
|
|
||||||
</div>
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
|
|
|
||||||
|
|
@ -1,27 +1,17 @@
|
||||||
<template>
|
<template>
|
||||||
<div>
|
<h1>Ivago</h1>
|
||||||
<h1>Ivago</h1>
|
<input v-model="query" v-on:keyup.enter="search" type="text" placeholder="Street..." />
|
||||||
<input
|
<div id="scroll-list">
|
||||||
v-model="query"
|
<ul v-if="msg === ''">
|
||||||
v-on:keyup.enter="search"
|
<li v-for="item in items">{{ item.name }} ({{ item.city }})</li>
|
||||||
type="text"
|
</ul>
|
||||||
placeholder="Street..." />
|
<p v-else>{{ msg }}</p>
|
||||||
<div id="scroll-list">
|
|
||||||
<ul v-if="msg === ''">
|
|
||||||
<li
|
|
||||||
v-for="item in items"
|
|
||||||
v-bind:key="`${item.name} (${item.city})`" >
|
|
||||||
{{ item.name }} ({{ item.city }})
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
<p v-else>{{ msg }}</p>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { defineComponent } from 'vue'
|
import { defineComponent } from 'vue'
|
||||||
import { Street, search as ivagoSearch } from '../api/ivago'
|
import { Street, search as ivago_search } from '../api/ivago'
|
||||||
|
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
name: 'Ivago',
|
name: 'Ivago',
|
||||||
|
|
@ -42,7 +32,7 @@ export default defineComponent({
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
ivagoSearch(this.query)
|
ivago_search(this.query)
|
||||||
.then((res: Street[]) => {
|
.then((res: Street[]) => {
|
||||||
this.items = res
|
this.items = res
|
||||||
this.msg = ''
|
this.msg = ''
|
||||||
|
|
|
||||||
Reference in New Issue