From 05e2d3a5b0ddca843df7cba7e182283d17afb141 Mon Sep 17 00:00:00 2001 From: ravi Date: Sun, 7 Apr 2024 14:31:30 +0530 Subject: [PATCH] now updating whatsapp number is mandatory to get access to group links. --- src/components/ClubPage.vue | 7 +++++-- src/components/UserPage.vue | 41 +++++++++++++++++++++++++------------ src/main.js | 2 +- 3 files changed, 34 insertions(+), 16 deletions(-) diff --git a/src/components/ClubPage.vue b/src/components/ClubPage.vue index 0929996..b8356ba 100644 --- a/src/components/ClubPage.vue +++ b/src/components/ClubPage.vue @@ -145,10 +145,13 @@ export default { console.log(result.data.success); this.access = result.data.success; this.club_list = result.data.club_list; - console.log(this.club_list) - console.log(result) + if (this.access === false){ + alert("Access Denied.") + + } } catch (error) { console.error('Network error : ', error); + alert("Access Denied.") } } else { alert("Please Sign In ") diff --git a/src/components/UserPage.vue b/src/components/UserPage.vue index 4146b02..4aacf38 100644 --- a/src/components/UserPage.vue +++ b/src/components/UserPage.vue @@ -60,7 +60,7 @@
GL Email : {{ - GLmail[0] }} + GLmail[0] }}
@@ -84,7 +84,7 @@ -
+
Update Number to Access Group Links
@@ -94,13 +94,14 @@ + v-model="Phone2" type="text" pattern="[6789][0-9]{9}">
@@ -141,12 +142,18 @@ export default { GroupUrl: null, GroupUrl2: null, GLmail: null, - Phone: null, + Phone: "", + Phone2: null, + updating: false, }; }, methods: { async updateuser() { - if (this.Phone) { + // Set updating to true when the update process begins + this.updating = true; + // Trim the input and check if it's not empty + const trimmedPhone = this.Phone2.trim(); + if (trimmedPhone) { let token = localStorage.getItem('Token'); try { const url = `${this.$globalData.backendUrl}/updateuser/`; @@ -157,22 +164,23 @@ export default { }; const data = { 'token': token, - 'phone' : this.Phone + 'phone': trimmedPhone, // Use the trimmed value }; const result = await axios.post(url, data, config); if (result.data.success == true) { - alert("Whatsapp Number Updated Successfully.") + alert("Whatsapp Number Updated Successfully."); location.reload(); } - - - - } catch (error) { console.error('Error updating user details:', error); } + } else { + // Display an error message or handle the empty input case + alert("Please enter a valid WhatsApp number."); } + this.updating = false; }, + }, async mounted() { const storedUserDetails = localStorage.getItem('userDetails'); @@ -203,6 +211,13 @@ export default { this.GroupUrl = result.data.link; this.GroupUrl2 = result.data.link2; this.GLmail = result.data.gl_email; + this.Phone = result.data.phone; + if (this.Phone === null) { + alert("Please Update your whatsapp number to access whatsapp group links.") + } + } + else { + alert("Data not found.") } } catch (error) { console.error('Error fetching user details:', error); diff --git a/src/main.js b/src/main.js index 9cd081c..65834ca 100644 --- a/src/main.js +++ b/src/main.js @@ -12,7 +12,7 @@ const storedUserDetails = localStorage.getItem('userDetails'); } const globalData = { backendUrl: "https://sundarbans.camlio.shop", - // backendUrl: "http://127.0.0.1:8000", (for development use) + // backendUrl: "http://127.0.0.1:8000", // (for development use) userDetails : userDetail };