Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | 2x 2x 2x 2x 10x 6x 6x 5x 1x 4x | import http from 'http';
import {Context} from '../context';
import {ShopifyOAuth} from '../auth/oauth/oauth';
import * as ShopifyErrors from '../error';
/**
* Finds and deletes the current user's session, based on the given request and response
*
* @param request Current HTTP request
* @param response Current HTTP response
* @param isOnline Whether to load online (default) or offline sessions (optional)
*/
export default async function deleteCurrentSession(
request: http.IncomingMessage,
response: http.ServerResponse,
isOnline = true,
): Promise<boolean | never> {
Context.throwIfUninitialized();
const sessionId = ShopifyOAuth.getCurrentSessionId(request, response, isOnline);
if (!sessionId) {
throw new ShopifyErrors.SessionNotFound('No active session found.');
}
return Context.SESSION_STORAGE.deleteSession(sessionId);
}
|