mirror of
https://github.com/YunoHost/yunohost-admin.git
synced 2024-09-03 20:06:15 +02:00
modify imports of api module
This commit is contained in:
parent
ee0a2a0020
commit
6a46132fd7
27 changed files with 40 additions and 28 deletions
|
@ -7,6 +7,11 @@ import store from '@/store'
|
|||
import { handleResponse, handleError } from './handlers'
|
||||
import { objectToParams } from '@/helpers/commons'
|
||||
|
||||
/**
|
||||
* A digested fetch response as an object, a string or an error.
|
||||
* @typedef {(Object|string|Error)} DigestedResponse
|
||||
*/
|
||||
|
||||
export default {
|
||||
options: {
|
||||
credentials: 'include',
|
||||
|
|
|
@ -4,9 +4,10 @@ import store from '@/store'
|
|||
* Handler for API responses.
|
||||
*
|
||||
* @param {Response} response - A fetch `Response` object.
|
||||
* @return {DigestedResponse} Parsed response's json, response's text or an error.
|
||||
* @return {(Object|String)} Parsed response's json or response's text.
|
||||
*/
|
||||
async function handleResponse (response) {
|
||||
store.dispatch('SERVER_RESPONDED')
|
||||
if (!response.ok) return handleError(response)
|
||||
// FIXME the api should always return json objects
|
||||
const responseText = await response.text()
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
<!-- <b-spinner /> -->
|
||||
<img class="pacman" src="@/assets/ajax-loader.gif">
|
||||
</div>
|
||||
|
||||
<b-card-body class="pb-4">
|
||||
<b-card-title class="text-center m-0" v-t="'api_waiting'" />
|
||||
|
||||
|
@ -27,7 +28,7 @@
|
|||
</b-card-body>
|
||||
|
||||
<!-- MESSAGES -->
|
||||
<b-list-group v-if="messages" flush>
|
||||
<b-list-group v-if="messages" flush class="rounded-0">
|
||||
<b-list-group-item
|
||||
v-for="({ text, type }, i) in messages" :key="i"
|
||||
:variant="type"
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import Vue from 'vue'
|
||||
import api from '@/helpers/api'
|
||||
import api from '@/api'
|
||||
|
||||
export default {
|
||||
state: () => ({
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import Vue from 'vue'
|
||||
import api, { timeout } from '@/helpers/api'
|
||||
import api from '@/api'
|
||||
import router from '@/router'
|
||||
import { timeout } from '@/helpers/commons'
|
||||
|
||||
export default {
|
||||
state: {
|
||||
|
|
|
@ -61,7 +61,7 @@
|
|||
</template>
|
||||
|
||||
<script>
|
||||
import api from '@/helpers/api'
|
||||
import api from '@/api'
|
||||
import { DomainForm, PasswordForm } from '@/components/reusableForms'
|
||||
import LoginView from '@/views/Login'
|
||||
|
||||
|
|
|
@ -42,8 +42,9 @@
|
|||
</template>
|
||||
|
||||
<script>
|
||||
import api, { objectToParams } from '@/helpers/api'
|
||||
import api from '@/api'
|
||||
import { formatI18nField, formatYunoHostArgument } from '@/helpers/yunohostArguments'
|
||||
import { objectToParams } from '@/helpers/commons'
|
||||
|
||||
export default {
|
||||
name: 'AppActions',
|
||||
|
|
|
@ -166,7 +166,7 @@
|
|||
</template>
|
||||
|
||||
<script>
|
||||
import api from '@/helpers/api'
|
||||
import api from '@/api'
|
||||
import InputHelper from '@/components/InputHelper'
|
||||
|
||||
export default {
|
||||
|
|
|
@ -46,8 +46,9 @@
|
|||
|
||||
<script>
|
||||
// FIXME needs test and rework
|
||||
import api, { objectToParams } from '@/helpers/api'
|
||||
import api from '@/api'
|
||||
import { formatI18nField, formatYunoHostArgument } from '@/helpers/yunohostArguments'
|
||||
import { objectToParams } from '@/helpers/commons'
|
||||
|
||||
export default {
|
||||
name: 'AppConfigPanel',
|
||||
|
|
|
@ -152,7 +152,7 @@
|
|||
</template>
|
||||
|
||||
<script>
|
||||
import api from '@/helpers/api'
|
||||
import api from '@/api'
|
||||
import { readableDate } from '@/filters/date'
|
||||
|
||||
export default {
|
||||
|
|
|
@ -64,8 +64,9 @@
|
|||
</template>
|
||||
|
||||
<script>
|
||||
import api, { objectToParams } from '@/helpers/api'
|
||||
import api from '@/api'
|
||||
import { formatYunoHostArgument } from '@/helpers/yunohostArguments'
|
||||
import { objectToParams } from '@/helpers/commons'
|
||||
|
||||
export default {
|
||||
name: 'AppInstall',
|
||||
|
|
|
@ -45,7 +45,7 @@
|
|||
</template>
|
||||
|
||||
<script>
|
||||
import api from '@/helpers/api'
|
||||
import api from '@/api'
|
||||
|
||||
export default {
|
||||
name: 'AppList',
|
||||
|
|
|
@ -90,7 +90,7 @@
|
|||
</template>
|
||||
|
||||
<script>
|
||||
import api from '@/helpers/api'
|
||||
import api from '@/api'
|
||||
|
||||
export default {
|
||||
name: 'BackupCreate',
|
||||
|
|
|
@ -141,7 +141,7 @@
|
|||
</template>
|
||||
|
||||
<script>
|
||||
import api from '@/helpers/api'
|
||||
import api from '@/api'
|
||||
import { readableDate } from '@/filters/date'
|
||||
import { humanSize } from '@/filters/size'
|
||||
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
</template>
|
||||
|
||||
<script>
|
||||
import api from '@/helpers/api'
|
||||
import api from '@/api'
|
||||
import { distanceToNow, readableDate } from '@/filters/date'
|
||||
import { humanSize } from '@/filters/size'
|
||||
|
||||
|
|
|
@ -107,7 +107,7 @@
|
|||
</template>
|
||||
|
||||
<script>
|
||||
import api from '@/helpers/api'
|
||||
import api from '@/api'
|
||||
import { distanceToNow } from '@/filters/date'
|
||||
|
||||
export default {
|
||||
|
|
|
@ -78,7 +78,7 @@
|
|||
</template>
|
||||
|
||||
<script>
|
||||
import api from '@/helpers/api'
|
||||
import api from '@/api'
|
||||
|
||||
export default {
|
||||
name: 'DomainCert',
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
</template>
|
||||
|
||||
<script>
|
||||
import api from '@/helpers/api'
|
||||
import api from '@/api'
|
||||
|
||||
export default {
|
||||
name: 'DomainDns',
|
||||
|
|
|
@ -86,7 +86,7 @@
|
|||
</template>
|
||||
|
||||
<script>
|
||||
import api from '@/helpers/api'
|
||||
import api from '@/api'
|
||||
import { distanceToNow } from '@/filters/date'
|
||||
|
||||
export default {
|
||||
|
|
|
@ -33,7 +33,7 @@
|
|||
</template>
|
||||
|
||||
<script>
|
||||
import api from '@/helpers/api'
|
||||
import api from '@/api'
|
||||
import { distanceToNow } from '@/filters/date'
|
||||
|
||||
export default {
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
</template>
|
||||
|
||||
<script>
|
||||
import api from '@/helpers/api'
|
||||
import api from '@/api'
|
||||
import { PasswordForm } from '@/components/reusableForms'
|
||||
import InputHelper from '@/components/InputHelper'
|
||||
|
||||
|
|
|
@ -133,7 +133,7 @@
|
|||
</template>
|
||||
|
||||
<script>
|
||||
import api from '@/helpers/api'
|
||||
import api from '@/api'
|
||||
|
||||
export default {
|
||||
name: 'ToolFirewall',
|
||||
|
|
|
@ -58,7 +58,8 @@
|
|||
</template>
|
||||
|
||||
<script>
|
||||
import api, { objectToParams } from '@/helpers/api'
|
||||
import api from '@/api'
|
||||
import { objectToParams } from '@/helpers/commons'
|
||||
import { readableDate } from '@/filters/date'
|
||||
|
||||
export default {
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
</template>
|
||||
|
||||
<script>
|
||||
import api from '@/helpers/api'
|
||||
import api from '@/api'
|
||||
import { distanceToNow, readableDate } from '@/filters/date'
|
||||
|
||||
export default {
|
||||
|
@ -70,7 +70,7 @@ export default {
|
|||
operation[index].class = 'success'
|
||||
} else {
|
||||
operation[index].icon = 'close'
|
||||
operation[index].class = 'success'
|
||||
operation[index].class = 'danger'
|
||||
}
|
||||
})
|
||||
this.operations = operation
|
||||
|
|
|
@ -101,7 +101,7 @@
|
|||
</template>
|
||||
|
||||
<script>
|
||||
import api from '@/helpers/api'
|
||||
import api from '@/api'
|
||||
|
||||
// FIXME not tested with pending migrations (disclaimer and stuff)
|
||||
|
||||
|
|
|
@ -51,7 +51,7 @@
|
|||
</template>
|
||||
|
||||
<script>
|
||||
import api from '@/helpers/api'
|
||||
import api from '@/api'
|
||||
import LoginView from '@/views/Login'
|
||||
|
||||
export default {
|
||||
|
|
|
@ -92,7 +92,7 @@
|
|||
</template>
|
||||
|
||||
<script>
|
||||
import api from '@/helpers/api'
|
||||
import api from '@/api'
|
||||
|
||||
export default {
|
||||
name: 'SystemUpdate',
|
||||
|
@ -135,9 +135,9 @@ export default {
|
|||
},
|
||||
|
||||
created () {
|
||||
this.fetchData()
|
||||
// FIXME Do not perform directly the update ?
|
||||
this.performUpdate()
|
||||
this.fetchData()
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
|
Loading…
Reference in a new issue