- Added support for connecting, refreshing, and removing custom domains through Cloudflare. - Updated API routes and validation schemas to handle new domain actions. - Refactored domain management logic in the dashboard to accommodate Cloudflare integration. - Enhanced user experience with clear status messages and DNS instructions for domain setup. - Updated translations and UI components to reflect new domain management features.
36 lines
1.0 KiB
TypeScript
36 lines
1.0 KiB
TypeScript
import { getOrgBySiteName } from '$features/org/api/org.server';
|
|
import { classroomio } from '$lib/utils/services/api';
|
|
import { getApiKeyHeaders } from '$lib/utils/services/api/server';
|
|
import { error } from '@sveltejs/kit';
|
|
|
|
export const load = async ({ params = { hash: '' } }) => {
|
|
try {
|
|
const token = decodeURIComponent(params.hash);
|
|
const response = await classroomio.invite.organization[':token'].preview.$get(
|
|
{
|
|
param: { token }
|
|
},
|
|
getApiKeyHeaders()
|
|
);
|
|
const result = await response.json();
|
|
|
|
if (!result.success || !result.data) {
|
|
throw new Error('Invalid organization invite payload');
|
|
}
|
|
|
|
const apiKeyHeaders = getApiKeyHeaders();
|
|
const currentOrg = result.data.organization.siteName
|
|
? await getOrgBySiteName(result.data.organization.siteName, apiKeyHeaders)
|
|
: null;
|
|
|
|
return {
|
|
token,
|
|
invite: result.data,
|
|
currentOrg
|
|
};
|
|
} catch (e) {
|
|
console.error('Error decoding organization invite params.hash', e);
|
|
throw error(404, 'Not found');
|
|
}
|
|
};
|