edit users
This commit is contained in:
@@ -1,13 +1,20 @@
|
||||
export function getAuthHeader(): ['authorization', string] | null {
|
||||
const authSession = useAuthSession().value;
|
||||
if (authSession == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return ['authorization', `${authSession.type} ${authSession.id}`];
|
||||
}
|
||||
export function getApiHeaders(
|
||||
includeAuth: boolean = true
|
||||
): Record<string, string> {
|
||||
const headers: Record<string, string> = {};
|
||||
|
||||
if (includeAuth) {
|
||||
const authSession = useAuthSession().value;
|
||||
|
||||
if (authSession != null) {
|
||||
headers['authorization'] = `${authSession.type} ${authSession.id}`;
|
||||
const header = getAuthHeader();
|
||||
if (header != null) {
|
||||
headers[header[0]] = header[1];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user