merge fetch and fetcher
This commit is contained in:
@@ -1,7 +1,18 @@
|
||||
"use client";
|
||||
import { Fetcher } from "openapi-typescript-fetch";
|
||||
import { getUser } from "./fetch";
|
||||
import { paths, components } from "muzak/data/types";
|
||||
import { oidcConfig } from "muzak/config/auth";
|
||||
import { User } from "oidc-client-ts";
|
||||
|
||||
export function getUser() {
|
||||
let oidcStorage = window?.sessionStorage.getItem(
|
||||
`oidc.user:${oidcConfig.authority}:${oidcConfig.client_id}`,
|
||||
);
|
||||
if (!oidcStorage) {
|
||||
return null;
|
||||
}
|
||||
return User.fromStorageString(oidcStorage);
|
||||
}
|
||||
|
||||
const fetcher = Fetcher.for<paths>();
|
||||
const BASE_URL = process.env.NEXT_PUBLIC_BACKEND_HOST!;
|
||||
|
||||
Reference in New Issue
Block a user