chore: add prettier frontent linter

This commit is contained in:
Oleg Lobanov
2021-03-21 12:51:58 +01:00
parent a721dc1f31
commit c44b37c50c
73 changed files with 18898 additions and 4499 deletions

View File

@@ -1,43 +1,42 @@
import store from '@/store'
import { renew } from '@/utils/auth'
import { baseURL } from '@/utils/constants'
import store from "@/store";
import { renew } from "@/utils/auth";
import { baseURL } from "@/utils/constants";
export async function fetchURL (url, opts) {
opts = opts || {}
opts.headers = opts.headers || {}
export async function fetchURL(url, opts) {
opts = opts || {};
opts.headers = opts.headers || {};
let { headers, ...rest } = opts
let { headers, ...rest } = opts;
const res = await fetch(`${baseURL}${url}`, {
headers: {
'X-Auth': store.state.jwt,
...headers
"X-Auth": store.state.jwt,
...headers,
},
...rest
})
...rest,
});
if (res.headers.get('X-Renew-Token') === 'true') {
await renew(store.state.jwt)
if (res.headers.get("X-Renew-Token") === "true") {
await renew(store.state.jwt);
}
return res
return res;
}
export async function fetchJSON (url, opts) {
const res = await fetchURL(url, opts)
export async function fetchJSON(url, opts) {
const res = await fetchURL(url, opts);
if (res.status === 200) {
return res.json()
return res.json();
} else {
throw new Error(res.status)
throw new Error(res.status);
}
}
export function removePrefix (url) {
url = url.split('/').splice(2).join('/')
export function removePrefix(url) {
url = url.split("/").splice(2).join("/");
if (url === '') url = '/'
if (url[0] !== '/') url = '/' + url
return url
if (url === "") url = "/";
if (url[0] !== "/") url = "/" + url;
return url;
}