mirror of
https://github.com/chinchang/web-maker.git
synced 2025-02-21 05:33:27 +01:00
fix file mode template fork condition
This commit is contained in:
parent
efb0492fc3
commit
a0c2c2002d
@ -1373,12 +1373,36 @@ export default class App extends Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
templateSelectHandler(template, isFileMode) {
|
templateSelectHandler(template, isFileMode) {
|
||||||
fetch(`templates/template-${isFileMode ? 'files-' : ''}${template.id}.json`)
|
if (isFileMode) {
|
||||||
.then(res => res.json())
|
itemService.getCountOfFileModeItems().then(count => {
|
||||||
.then(json => {
|
if (count < 2) {
|
||||||
this.forkItem(json);
|
fetch(
|
||||||
|
`templates/template-${isFileMode ? 'files-' : ''}${
|
||||||
|
template.id
|
||||||
|
}.json`
|
||||||
|
)
|
||||||
|
.then(res => res.json())
|
||||||
|
.then(json => {
|
||||||
|
this.forkItem(json);
|
||||||
|
});
|
||||||
|
this.setState({ isCreateNewModalOpen: false });
|
||||||
|
} else {
|
||||||
|
trackEvent('ui', 'FileModeCreationLimitMessageSeen');
|
||||||
|
return alert(
|
||||||
|
'"Files mode" is currently in beta and is limited to only 2 creations per user. You have already made 2 creations in Files mode.\n\nNote: You can choose to delete old ones to create new.'
|
||||||
|
);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
this.setState({ isCreateNewModalOpen: false });
|
} else {
|
||||||
|
fetch(
|
||||||
|
`templates/template-${isFileMode ? 'files-' : ''}${template.id}.json`
|
||||||
|
)
|
||||||
|
.then(res => res.json())
|
||||||
|
.then(json => {
|
||||||
|
this.forkItem(json);
|
||||||
|
});
|
||||||
|
this.setState({ isCreateNewModalOpen: false });
|
||||||
|
}
|
||||||
}
|
}
|
||||||
importGithubRepoSelectHandler(repoUrl) {
|
importGithubRepoSelectHandler(repoUrl) {
|
||||||
importGithubRepo(repoUrl).then(files => {
|
importGithubRepo(repoUrl).then(files => {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user