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