Browse Source

Send credentials with API calls, to make HTTP auth work

Also serve OSM tiles with HTTPS
responsive
Lucas Verney 6 years ago
parent
commit
847a5954d5
  1. 10
      flatisfy/web/js_src/api/index.js
  2. 2
      flatisfy/web/js_src/components/flatsmap.vue
  3. 14
      flatisfy/web/js_src/components/flatstable.vue
  4. 4
      flatisfy/web/js_src/i18n/en/index.js
  5. 2
      flatisfy/web/js_src/store/getters.js
  6. 2
      flatisfy/web/js_src/views/details.vue

10
flatisfy/web/js_src/api/index.js

@ -4,7 +4,7 @@ require('es6-promise').polyfill() @@ -4,7 +4,7 @@ require('es6-promise').polyfill()
require('isomorphic-fetch')
export const getFlats = function (callback) {
fetch('/api/v1/flats')
fetch('/api/v1/flats', { credentials: 'same-origin' })
.then(function (response) {
return response.json()
}).then(function (json) {
@ -22,7 +22,10 @@ export const getFlats = function (callback) { @@ -22,7 +22,10 @@ export const getFlats = function (callback) {
}
export const getFlat = function (flatId, callback) {
fetch('/api/v1/flat/' + encodeURIComponent(flatId))
fetch(
'/api/v1/flat/' + encodeURIComponent(flatId),
{ credentials: 'same-origin' }
)
.then(function (response) {
return response.json()
}).then(function (json) {
@ -40,6 +43,7 @@ export const updateFlatStatus = function (flatId, newStatus, callback) { @@ -40,6 +43,7 @@ export const updateFlatStatus = function (flatId, newStatus, callback) {
fetch(
'/api/v1/flat/' + encodeURIComponent(flatId) + '/status',
{
credentials: 'same-origin',
method: 'POST',
headers: {
'Content-Type': 'application/json'
@ -52,7 +56,7 @@ export const updateFlatStatus = function (flatId, newStatus, callback) { @@ -52,7 +56,7 @@ export const updateFlatStatus = function (flatId, newStatus, callback) {
}
export const getTimeToPlaces = function (callback) {
fetch('/api/v1/time_to/places')
fetch('/api/v1/time_to/places', { credentials: 'same-origin' })
.then(function (response) {
return response.json()
}).then(function (json) {

2
flatisfy/web/js_src/components/flatsmap.vue

@ -37,7 +37,7 @@ export default { @@ -37,7 +37,7 @@ export default {
maxZoom: 17
},
tiles: {
url: 'http://{s}.tile.osm.org/{z}/{x}/{y}.png',
url: 'https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png',
attribution: '&copy; <a href="http://osm.org/copyright">OpenStreetMap</a> contributors'
},
icons: {

14
flatisfy/web/js_src/components/flatstable.vue

@ -76,9 +76,9 @@ @@ -76,9 +76,9 @@
</template>
<script>
import "font-awesome-webpack"
import 'font-awesome-webpack'
import { capitalize } from "../tools"
import { capitalize } from '../tools'
export default {
data () {
@ -94,7 +94,7 @@ export default { @@ -94,7 +94,7 @@ export default {
sortedFlats () {
return this.flats.sort(
(flat1, flat2) => {
if (this.sortOrder === "up") {
if (this.sortOrder === 'up') {
return flat1[this.sortBy] > flat2[this.sortBy]
} else {
return flat1[this.sortBy] < flat2[this.sortBy]
@ -110,13 +110,13 @@ export default { @@ -110,13 +110,13 @@ export default {
},
updateSortBy (field) {
if (this.sortBy === field) {
if (this.sortOrder === "up") {
this.sortOrder = "down"
if (this.sortOrder === 'up') {
this.sortOrder = 'down'
} else {
this.sortOrder = "up"
this.sortOrder = 'up'
}
} else {
this.sortBy = field;
this.sortBy = field
}
},
capitalize: capitalize

4
flatisfy/web/js_src/i18n/en/index.js

@ -9,8 +9,8 @@ export default { @@ -9,8 +9,8 @@ export default {
'External_link': 'External link',
'Follow': 'Follow',
'Close': 'Close',
"sortUp": 'Sort in ascending order',
"sortDown": 'Sort in descending order'
'sortUp': 'Sort in ascending order',
'sortDown': 'Sort in descending order'
},
home: {
'new_available_flats': 'New available flats'

2
flatisfy/web/js_src/store/getters.js

@ -9,7 +9,7 @@ export default { @@ -9,7 +9,7 @@ export default {
const postalCodeBuckets = {}
state.flats.forEach(flat => {
if (filter && filter(flat)) {
if (filter && filter(flat)) { // TODO
const postalCode = flat.flatisfy_postal_code.postal_code
if (!postalCodeBuckets[postalCode]) {
postalCodeBuckets[postalCode] = {

2
flatisfy/web/js_src/views/details.vue

@ -159,7 +159,7 @@ @@ -159,7 +159,7 @@
</template>
<script>
import "font-awesome-webpack"
import 'font-awesome-webpack'
import FlatsMap from '../components/flatsmap.vue'
import Slider from '../components/slider.vue'

Loading…
Cancel
Save