25 lines
408 B
TypeScript
25 lines
408 B
TypeScript
import { HeaderContent } from './types';
|
|
|
|
class Header {
|
|
public header: HeaderContent;
|
|
|
|
constructor() {
|
|
this.header = {};
|
|
}
|
|
|
|
updateToken(token: string): void {
|
|
this.header = {
|
|
...this.header,
|
|
Authorization: `Bearer ${token}`,
|
|
};
|
|
}
|
|
|
|
removeToken(): void {
|
|
if ('Authorization' in this.header) {
|
|
delete this.header.Authorization;
|
|
}
|
|
}
|
|
}
|
|
|
|
export default Header;
|