Wait until externalID has been fetched to render "Make Public"
This commit is contained in:
parent
bfb404575b
commit
c607c0cf16
|
@ -56,20 +56,25 @@ export function renderLoginForm() {
|
||||||
export function renderMakePublic() {
|
export function renderMakePublic() {
|
||||||
const editSettingsTab = document.getElementById('editSettingsTab');
|
const editSettingsTab = document.getElementById('editSettingsTab');
|
||||||
const { isPublic } = window.currentDictionary.settings;
|
const { isPublic } = window.currentDictionary.settings;
|
||||||
const { externalID } = window.currentDictionary;
|
let waitForSync = setInterval(() => {
|
||||||
const editSettingsTabHTML = `<label>Make Public
|
if (window.currentDictionary.hasOwnProperty('externalID') && !isNaN(window.currentDictionary.externalID)) {
|
||||||
<input type="checkbox" id="editIsPublic"${isPublic ? ' checked' : ''}><br>
|
clearInterval(waitForSync);
|
||||||
<small>Checking this box will make this public via a link you can share with others.</small>
|
const { externalID } = window.currentDictionary;
|
||||||
</label>
|
const editSettingsTabHTML = `<label>Make Public
|
||||||
<p id="publicLinkDisplay" style="${!isPublic ? 'display:none;': ''}margin-left:20px;">
|
<input type="checkbox" id="editIsPublic"${isPublic ? ' checked' : ''}><br>
|
||||||
<strong>Public Link:</strong><br>
|
<small>Checking this box will make this public via a link you can share with others.</small>
|
||||||
<input readonly id="publicLink" value="${document.domain + window.location.pathname + (externalID ? externalID.toString() : '')}">
|
</label>
|
||||||
<a class="small button" id="publicLinkCopy">Copy</a>
|
<p id="publicLinkDisplay" style="${!isPublic ? 'display:none;': ''}margin-left:20px;">
|
||||||
</p>
|
<strong>Public Link:</strong><br>
|
||||||
`;
|
<input readonly id="publicLink" value="${document.domain + window.location.pathname + (externalID ? externalID.toString() : '')}">
|
||||||
editSettingsTab.innerHTML += editSettingsTabHTML;
|
<a class="small button" id="publicLinkCopy">Copy</a>
|
||||||
|
</p>
|
||||||
|
`;
|
||||||
|
editSettingsTab.innerHTML += editSettingsTabHTML;
|
||||||
|
|
||||||
setupMakePublic();
|
setupMakePublic();
|
||||||
|
}
|
||||||
|
}, 100);
|
||||||
}
|
}
|
||||||
|
|
||||||
export function renderAccountSettings() {
|
export function renderAccountSettings() {
|
||||||
|
|
Loading…
Reference in New Issue