Skip to content
This repository has been archived by the owner on Sep 8, 2023. It is now read-only.

Commit

Permalink
Switch to @nextcloud packages
Browse files Browse the repository at this point in the history
Signed-off-by: Julius Härtl <[email protected]>
  • Loading branch information
juliusknorr committed Aug 12, 2022
1 parent 05e1853 commit 33f7e57
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 27 deletions.
21 changes: 18 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
},
"dependencies": {
"@nextcloud/axios": "^2.0.0",
"@nextcloud/router": "^2.0.0",
"vue": "^2.7.8"
},
"devDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion src/ReferenceWidget.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<template>
<div>
<div v-if="noAccess">
<div v-if="noAccess" class="widget-default">
<p>You may not have access to this reference!</p>
</div>

Expand Down
36 changes: 13 additions & 23 deletions src/References.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
</template>
<script>
import ReferenceWidget from './ReferenceWidget.vue'
import axios from '@nextcloud/axios'
import { generateOcsUrl } from '@nextcloud/router'
export default {
name: 'References',
Expand All @@ -17,7 +19,8 @@ export default {
default: ''
},
referenceData: {
type: Object
type: Object,
default: null,
},
limit: {
type: Number,
Expand Down Expand Up @@ -59,29 +62,16 @@ export default {
return
}
fetch('http://nextcloud.dev.local/ocs/v2.php/references/extract?format=json', {
method: 'POST',
body: JSON.stringify({
text: this.text,
resolve: true,
requesttoken: window.oc_requesttoken,
limit: this.limit
}),
headers: {
'Content-Type': 'application/json',
requesttoken: window.oc_requesttoken
}
axios.post(generateOcsUrl('references/extract', 2), {
text: this.text,
resolve: true,
limit: this.limit
}).then((response) => {
this.references = response.data.ocs.data.references
this.loading = false
}).catch((error) => {
this.loading = false
})
.then(response => response.json())
.then(json => {
console.log(json)
this.references = json.ocs.data.references
this.loading = false
})
.catch(error => {
console.error(error)
this.loading = false
})
}
}
}
Expand Down

0 comments on commit 33f7e57

Please sign in to comment.