Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: Zenika/grenoble-hands-on-vuejs
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: step1
Choose a base ref
...
head repository: Zenika/grenoble-hands-on-vuejs
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: step2
Choose a head ref
  • 1 commit
  • 2 files changed
  • 1 contributor

Commits on Oct 23, 2023

  1. step2

    fatb38 committed Oct 23, 2023
    Copy the full SHA
    7f5d263 View commit details
Showing with 13 additions and 10 deletions.
  1. +6 −8 src/views/CityView.vue
  2. +7 −2 src/views/HomeView.vue
14 changes: 6 additions & 8 deletions src/views/CityView.vue
Original file line number Diff line number Diff line change
@@ -1,32 +1,30 @@
<script setup>
// TODO Remove this rule with step 2
/* eslint-disable no-unused-vars */
import { onMounted, ref } from 'vue'
import LMap from '../components/LMap.vue'
import { getCityTodayWeather } from '../api/weather.api'
import { useCitiesStore } from '../store/cities.store'
const props = defineProps({
cityName: {
type: String,
required: true
}
})
const cityLatitude = ref(45.183916)
const cityLongitude = ref(5.703630)
const store = useCitiesStore()
const { latitude, longitude } = store.getCityByName(props.cityName)
const weather = ref(null)
onMounted(async () => {
weather.value = await getCityTodayWeather(cityLongitude, cityLatitude)
weather.value = await getCityTodayWeather(longitude, latitude)
})
</script>

<template>
<h1 class="title">Cities weather</h1>
<article class="panel is-primary">
<div class="panel-heading"><h2>GRENOBLE</h2></div>
<div class="panel-heading"><h2>{{ props.cityName }}</h2></div>
<div class="panel-block">
<l-map :zoom="13" :lat="cityLatitude" :long="cityLongitude" />
<l-map :zoom="13" :lat="latitude" :long="longitude" />
</div>
<div class="panel-block">
<table class="table is-flex-grow-1">
9 changes: 7 additions & 2 deletions src/views/HomeView.vue
Original file line number Diff line number Diff line change
@@ -10,8 +10,13 @@ const cities = store.cities
<h1 class="title">Offices</h1>

<div class="panel">
<router-link class="panel-block p-4" :to="{ name: 'City', params: { cityName: cities[0].name }}">
<h2 class="subtitle">{{ cities[0].name }}</h2>
<router-link
v-for="city in cities"
:key="city"
class="panel-block p-4"
:to="{ name: 'City', params: { cityName: city.name }}"
>
<h2 class="subtitle">{{ city.name }}</h2>
</router-link>
</div>
</section>