refactor: enforce setAuthToken to strictly require a token, add /notes to gitignore, and include logo asset.
This commit is contained in:
@@ -6,7 +6,7 @@ type HttpClient = typeof httpClient;
|
|||||||
|
|
||||||
interface ApiContextValue {
|
interface ApiContextValue {
|
||||||
client: HttpClient;
|
client: HttpClient;
|
||||||
setAuthToken: (token?: string | null) => void;
|
setAuthToken: (token: string) => void;
|
||||||
clearAuthToken: () => void;
|
clearAuthToken: () => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -281,12 +281,8 @@ export const listTenants = async (): Promise<TenantSnippet[]> => {
|
|||||||
return Array.isArray(data?.tenants) ? data.tenants : [];
|
return Array.isArray(data?.tenants) ? data.tenants : [];
|
||||||
};
|
};
|
||||||
|
|
||||||
export const setAuthToken = (token?: string | null) => {
|
export const setAuthToken = (token: string) => {
|
||||||
if (token) {
|
api.defaults.headers.common.Authorization = `Bearer ${token}`;
|
||||||
api.defaults.headers.common.Authorization = `Bearer ${token}`;
|
|
||||||
} else {
|
|
||||||
delete api.defaults.headers.common.Authorization;
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export const clearAuthToken = () => {
|
export const clearAuthToken = () => {
|
||||||
|
|||||||
Reference in New Issue
Block a user