refactor
This commit is contained in:
		| @ -12,7 +12,7 @@ async function showPage({ rootEl, peertubeHelpers }) { | ||||
|     const description = await peertubeHelpers.markdownRenderer.enhancedMarkdownToHTML(settings["sell-description"]); | ||||
|     const plans = []; | ||||
|  | ||||
|     for(let i = 1; i <= 5; i++) { | ||||
|     for (let i = 1; i <= 5; i++) { | ||||
|         const name = settings["plan-" + i + "-name"]; | ||||
|         const key = settings["plan-" + i + "-key"]; | ||||
|         const storage = settings["plan-" + i + "-storage"]; | ||||
| @ -37,13 +37,14 @@ async function showPage({ rootEl, peertubeHelpers }) { | ||||
|     // If have error | ||||
|     if (!data || !data.status || (data.status && data.status !== "success")) { | ||||
|         peertubeHelpers.notifier.error(data.message || "Unknown error"); | ||||
|     }else{ | ||||
|     } else { | ||||
|         session_id = data?.data?.session_id; | ||||
|         sub_plan = data?.data?.sub_plan; | ||||
|     } | ||||
|  | ||||
|     rootEl.innerHTML = ` | ||||
|         <div class="ncd-content text-center"> | ||||
|         <h4><i>To subscribe to a storage plan with cryptocurrency (BTC, ETC, XMR) or cancel/update your subscription tier, <a href="/about/contact">contact us</a>.</i></h4> | ||||
|             <h1>${await peertubeHelpers.translate("Choose your Storage Plan")}</h1> | ||||
|             <p>${description.length ? description : await peertubeHelpers.translate("You want tu spport us ? Or need more space ? Your in the right place!")}</p> | ||||
|             <div class="mt-5"> | ||||
| @ -65,17 +66,13 @@ async function showPage({ rootEl, peertubeHelpers }) { | ||||
|                         </div> | ||||
|                     `))).join("")} | ||||
|                 </div> | ||||
|  | ||||
|                 <h4><i>NCTV also offers cryptocurrency subscriptions for media storage. Contact Matty on <a href="https://nicecrew.digital/@matty" target="_blank">NCD</a>, <a href="https://matrix.to/#/@matty:chat.nicecrew.digital" target="_blank">Matrix</a>, or via <a href="mailto:matty@nicecrew.digital">email</a>.</i></h4> | ||||
|             </div> | ||||
|              | ||||
|              | ||||
|             <div class="mt-5"> | ||||
|                 <form method="POST" action="#" id="formManageSub"> | ||||
|                     <input type="hidden" id="session-id" name="session_id" value="${session_id}" /> | ||||
|                     <button id="checkout-and-portal-button" type="submit" class="btn btn-primary">${await translate("Manage my Subscription")}</button> | ||||
|                 </form> | ||||
|  | ||||
|             </div> | ||||
|              | ||||
|  | ||||
| @ -108,7 +105,7 @@ function listenSubmitSubscription(peertubeHelpers) { | ||||
|                     headers: peertubeHelpers.getAuthHeader(), | ||||
|                     body: form, | ||||
|                 }).then((res) => res.json()).then((data) => { | ||||
|                     if(!data || !data.status || data.status !== "success") { | ||||
|                     if (!data || !data.status || data.status !== "success") { | ||||
|                         peertubeHelpers.notifier.error(data.message || "Unknown error"); | ||||
|                         return; | ||||
|                     } | ||||
| @ -137,7 +134,7 @@ function listenSubmitSubscription(peertubeHelpers) { | ||||
|                 headers: peertubeHelpers.getAuthHeader(), | ||||
|                 body: form, | ||||
|             }).then((res) => res.json()).then((data) => { | ||||
|                 if(!data || !data.status || data.status !== "success") { | ||||
|                 if (!data || !data.status || data.status !== "success") { | ||||
|                     peertubeHelpers.notifier.error(data.message || "Unknown error"); | ||||
|                     return; | ||||
|                 } | ||||
|  | ||||
		Reference in New Issue
	
	Block a user