forked from mirrors/homebox
frontend: cleanup
* dummy commit * cleanup workflows * setup and run eslint * add linter to CI * use eslint for formatting * reorder rules * drop editor config
This commit is contained in:
parent
78fa714297
commit
75c633dcb5
65 changed files with 2048 additions and 641 deletions
|
@ -1,21 +1,21 @@
|
|||
import { PublicApi } from '~~/lib/api/public';
|
||||
import { UserApi } from '~~/lib/api/user';
|
||||
import { Requests } from '~~/lib/requests';
|
||||
import { useAuthStore } from '~~/stores/auth';
|
||||
import { PublicApi } from "~~/lib/api/public";
|
||||
import { UserApi } from "~~/lib/api/user";
|
||||
import { Requests } from "~~/lib/requests";
|
||||
import { useAuthStore } from "~~/stores/auth";
|
||||
|
||||
function logger(r: Response) {
|
||||
console.log(`${r.status} ${r.url} ${r.statusText}`);
|
||||
}
|
||||
|
||||
export function usePublicApi(): PublicApi {
|
||||
const requests = new Requests('', '', {});
|
||||
const requests = new Requests("", "", {});
|
||||
return new PublicApi(requests);
|
||||
}
|
||||
|
||||
export function useUserApi(): UserApi {
|
||||
const authStore = useAuthStore();
|
||||
|
||||
const requests = new Requests('', () => authStore.token, {});
|
||||
const requests = new Requests("", () => authStore.token, {});
|
||||
requests.addResponseInterceptor(logger);
|
||||
requests.addResponseInterceptor(r => {
|
||||
if (r.status === 401) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue