19 lines
782 B
JavaScript
19 lines
782 B
JavaScript
// Shared by the org-* and setup checks: acting in a seeded org and the 404s a
|
|
// fresh org's pages are built to survive.
|
|
const ORG = { home: 'org-sys', beta: 'org-beta', outsider: 'org-gamma' };
|
|
|
|
// A new org has written no documents, and the instance-only reads answer
|
|
// not found outside the system org.
|
|
const ABSENT = /status of 404.*\/api\/(control-plane|schedules|identities)/;
|
|
|
|
// Selects an org the way the topbar does, over the page's own session.
|
|
async function selectOrg(page, id) {
|
|
const origin = new URL(page.url() === 'about:blank' ? 'http://localhost:5173' : page.url()).origin;
|
|
return page.request.put(`${origin}/api/orgs/current`, {
|
|
headers: { 'X-Archie-CSRF': '1', Origin: origin },
|
|
data: { id },
|
|
});
|
|
}
|
|
|
|
module.exports = { ORG, ABSENT, selectOrg };
|