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 {
|
||||
client: HttpClient;
|
||||
setAuthToken: (token?: string | null) => void;
|
||||
setAuthToken: (token: string) => void;
|
||||
clearAuthToken: () => void;
|
||||
}
|
||||
|
||||
|
||||
@@ -281,12 +281,8 @@ export const listTenants = async (): Promise<TenantSnippet[]> => {
|
||||
return Array.isArray(data?.tenants) ? data.tenants : [];
|
||||
};
|
||||
|
||||
export const setAuthToken = (token?: string | null) => {
|
||||
if (token) {
|
||||
api.defaults.headers.common.Authorization = `Bearer ${token}`;
|
||||
} else {
|
||||
delete api.defaults.headers.common.Authorization;
|
||||
}
|
||||
export const setAuthToken = (token: string) => {
|
||||
api.defaults.headers.common.Authorization = `Bearer ${token}`;
|
||||
};
|
||||
|
||||
export const clearAuthToken = () => {
|
||||
|
||||
Reference in New Issue
Block a user