Split browser workflows from presentation

This commit is contained in:
ms2k 2026-07-20 03:37:35 +09:00
commit 0c2d992224

View file

@ -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,