Send credentials with API calls, to make HTTP auth work
Also serve OSM tiles with HTTPS
This commit is contained in:
parent
f7c7459d96
commit
847a5954d5
@ -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) {
|
||||
}
|
||||
|
||||
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) {
|
||||
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) {
|
||||
}
|
||||
|
||||
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) {
|
||||
|
@ -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: '© <a href="http://osm.org/copyright">OpenStreetMap</a> contributors'
|
||||
},
|
||||
icons: {
|
||||
|
@ -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 {
|
||||
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 {
|
||||
},
|
||||
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
|
||||
|
@ -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'
|
||||
|
@ -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] = {
|
||||
|
@ -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…
Reference in New Issue
Block a user