Make fetch cordova compatible
Signed-off-by: Justin Georgi <justin.georgi@gmail.com>
This commit is contained in:
@@ -120,7 +120,6 @@
|
||||
import submitMixin from './submit-mixin'
|
||||
import detectionMixin from './detection-mixin'
|
||||
import cameraMixin from './camera-mixin'
|
||||
import App from 'framework7-vue/components/app'
|
||||
|
||||
export default {
|
||||
mixins: [submitMixin, detectionMixin, cameraMixin],
|
||||
@@ -188,7 +187,7 @@ import App from 'framework7-vue/components/app'
|
||||
}
|
||||
this.modelLocation = `${modelRoot}/models/${this.detectorName}${this.otherSettings.mini ? '-mini' : ''}/model.json`
|
||||
this.miniLocation = `${modelRoot}/models/${this.detectorName}-mini/model.json`
|
||||
fetch(`./models/${this.detectorName}/classes.json`)
|
||||
fetch(`${this.isCordova ? 'https://localhost' : '.'}/models/${this.detectorName}/classes.json`)
|
||||
.then((mod) => { return mod.json() })
|
||||
.then((classes) => {
|
||||
this.classesList = classes
|
||||
|
||||
@@ -45,6 +45,7 @@
|
||||
limbsDetails: { "version": "N/A" },
|
||||
headneckDetails: { "version": "N/A" },
|
||||
alvinnVersion: store().getVersion,
|
||||
isCordova: !!window.cordova,
|
||||
otherSettings: {}
|
||||
}
|
||||
},
|
||||
@@ -54,16 +55,16 @@
|
||||
created () {
|
||||
var loadOtherSettings = localStorage.getItem('otherSettings')
|
||||
if (loadOtherSettings) this.otherSettings = JSON.parse(loadOtherSettings)
|
||||
fetch('./models/thorax/descript.json')
|
||||
fetch(`${this.isCordova ? 'https://localhost' : '.'}/models/thorax/descript.json`)
|
||||
.then((mod) => { return mod.json() })
|
||||
.then((desc) => { this.thoraxDetails = desc })
|
||||
fetch('./models/thorax-mini/descript.json')
|
||||
fetch(`${this.isCordova ? 'https://localhost' : '.'}/models/thorax-mini/descript.json`)
|
||||
.then((mod) => { return mod.json() })
|
||||
.then((desc) => { this.miniThoraxDetails = desc })
|
||||
fetch('./models/abdomen/descript.json')
|
||||
fetch(`${this.isCordova ? 'https://localhost' : '.'}/models/abdomen/descript.json`)
|
||||
.then((mod) => { return mod.json() })
|
||||
.then((desc) => { this.abdomenDetails = desc })
|
||||
fetch('./models/abdomen-mini/descript.json')
|
||||
fetch(`${this.isCordova ? 'https://localhost' : '.'}/models/abdomen-mini/descript.json`)
|
||||
.then((mod) => { return mod.json() })
|
||||
.then((desc) => { this.miniAbdomenDetails = desc })
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user