mirror of
https://github.com/chinchang/web-maker.git
synced 2025-02-19 20:55:55 +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) {
|
||||
fetch(`templates/template-${isFileMode ? 'files-' : ''}${template.id}.json`)
|
||||
.then(res => res.json())
|
||||
.then(json => {
|
||||
this.forkItem(json);
|
||||
if (isFileMode) {
|
||||
itemService.getCountOfFileModeItems().then(count => {
|
||||
if (count < 2) {
|
||||
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) {
|
||||
importGithubRepo(repoUrl).then(files => {
|
||||
|
Loading…
x
Reference in New Issue
Block a user