Skip to content
This repository was archived by the owner on Jul 9, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -47,19 +47,21 @@ export function CreateOptionsV2(props: CreateOptionsProps) {
const decoded = decodeURIComponent(props.location.search);
const { source, payload } = querystring.parse(decoded);
if (typeof source === 'string' && typeof payload === 'string') {
const alias = getAliasFromPayload(source, payload);
// check to see if Composer currently has a bot project corresponding to the alias
axios
.get<any>(`/api/projects/alias/${alias}`)
.then((aliasRes) => {
if (aliasRes.status === 200) {
navigate(`/bot/${aliasRes.data.id}`);
return;
}
})
.catch((e) => {
setIsOpenOptionsModal(true);
});
getAliasFromPayload(source, payload).then((alias) => {
// check to see if Composer currently has a bot project corresponding to the alias
axios
.get<any>(`/api/projects/alias/${alias}`)
.then((aliasRes) => {
if (aliasRes.status === 200) {
navigate(`/bot/${aliasRes.data.id}`);
return;
}
})
.catch((e) => {
setIsOpenOptionsModal(true);
});
});

return;
}
}
Expand Down
12 changes: 9 additions & 3 deletions Composer/packages/client/src/recoilModel/dispatchers/project.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ import {
projectMetaDataState,
selectedTemplateReadMeState,
showCreateQnAFromUrlDialogState,
settingsState,
} from '../atoms';
import { botRuntimeOperationsSelector, rootBotProjectIdSelector } from '../selectors';
import { mergePropertiesManagedByRootBot, postRootBotCreation } from '../../recoilModel/dispatchers/utils/project';
Expand Down Expand Up @@ -256,10 +257,15 @@ export const projectDispatcher = () => {

if (profile && alias) {
const dispatcher = await snapshot.getPromise(dispatcherState);
const { publishTargets } = await snapshot.getPromise(settingsState(projectId));
const newProfile = await getPublishProfileFromPayload(profile, source);

newProfile && dispatcher.setPublishTargets([newProfile], projectId);

if (newProfile) {
const newPublishTargets = publishTargets
? publishTargets.filter((item) => item.name !== newProfile.name)
: [];
newPublishTargets.push(newProfile);
dispatcher.setPublishTargets(newPublishTargets, projectId);
}
await httpClient.post(`/projects/${projectId}/alias/set`, { alias });
}
}
Expand Down