feat(dns): add domain migration between dcrouter and provider-managed DNS with unified ACME managed-domain handling
This commit is contained in:
@@ -1887,6 +1887,32 @@ export const syncDomainAction = domainsStatePart.createAction<{ id: string }>(
|
||||
},
|
||||
);
|
||||
|
||||
export const migrateDomainAction = domainsStatePart.createAction<{
|
||||
id: string;
|
||||
targetSource: interfaces.data.TDomainSource;
|
||||
targetProviderId?: string;
|
||||
deleteExistingProviderRecords?: boolean;
|
||||
}>(
|
||||
async (statePartArg, dataArg, actionContext): Promise<IDomainsState> => {
|
||||
const context = getActionContext();
|
||||
try {
|
||||
const request = new plugins.domtools.plugins.typedrequest.TypedRequest<
|
||||
interfaces.requests.IReq_MigrateDomain
|
||||
>('/typedrequest', 'migrateDomain');
|
||||
const response = await request.fire({ identity: context.identity!, ...dataArg });
|
||||
if (!response.success) {
|
||||
return { ...statePartArg.getState()!, error: response.message || 'Migration failed' };
|
||||
}
|
||||
return await actionContext!.dispatch(fetchDomainsAndProvidersAction, null);
|
||||
} catch (error: unknown) {
|
||||
return {
|
||||
...statePartArg.getState()!,
|
||||
error: error instanceof Error ? error.message : 'Migration failed',
|
||||
};
|
||||
}
|
||||
},
|
||||
);
|
||||
|
||||
export const createDnsRecordAction = domainsStatePart.createAction<{
|
||||
domainId: string;
|
||||
name: string;
|
||||
|
||||
Reference in New Issue
Block a user