Split browser workflows from presentation
This commit is contained in:
parent
c9642f4067
commit
0c2d992224
1 changed files with 1683 additions and 854 deletions
|
|
@ -145,6 +145,24 @@ export class BrowserProductClient implements ProductEndpoint {
|
|||
);
|
||||
}
|
||||
|
||||
async logout(csrfToken: string): Promise<void> {
|
||||
const response = await this.fetchRequest(
|
||||
this.baseUrl === '' ? '/logout' : new URL('/logout', this.baseUrl),
|
||||
{
|
||||
method: 'POST',
|
||||
credentials: 'same-origin',
|
||||
headers: { 'X-CSRF-Token': csrfToken }
|
||||
}
|
||||
);
|
||||
if (!response.ok) {
|
||||
throw new ProductRequestError({
|
||||
kind: 'unexpected-http',
|
||||
status: response.status,
|
||||
message: response.statusText
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
private async jsonRequest<Success, Code extends string>(
|
||||
contract: EndpointContract,
|
||||
request: object,
|
||||
|
|
|
|||
Loading…
Reference in a new issue