Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

now updating whatsapp number is mandatory to get access to group links. #47

Merged
merged 1 commit into from
Apr 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions src/components/ClubPage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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 ")
Expand Down
41 changes: 28 additions & 13 deletions src/components/UserPage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
<div class="mt-4">
<span v-if="GLmail && GLmail.length > 0"
class="block mb-2 text-sm font-medium text-gray-600 text-center dark:text-gray-200">GL Email : {{
GLmail[0] }}
GLmail[0] }}
</span>
</div>

Expand All @@ -84,7 +84,7 @@
</div>
</div>

<div v-else>
<div v-if="Phone === null">
<h6 style="color: red;">Update Number to Access Group Links</h6>
<div class="mt-4">
<div class="flex justify-between">
Expand All @@ -94,13 +94,14 @@

<input id="loggingPassword"
class="block w-full px-4 py-2 text-gray-700 bg-white border rounded-lg dark:bg-black dark:text-gray-300 dark:border-gray-600 focus:border-blue-400 focus:ring-opacity-40 dark:focus:border-blue-300 focus:outline-none focus:ring focus:ring-blue-300"
v-model="Phone" type="text" pattern="[6789][0-9]{9}">
v-model="Phone2" type="text" pattern="[6789][0-9]{9}">
</div>
<div class="mt-6">
<button
class="w-full px-6 py-3 text-sm font-medium tracking-wide text-black capitalize transition-colors duration-300 transform bg-gray-200 rounded-lg hover:bg-gray-400 focus:outline-none focus:ring focus:ring-gray-300 focus:ring-opacity-50"
@click="updateuser">
Update Number
@click="updateuser" :disabled="updating">
<span v-if="!updating">Update Number</span>
<span v-else>Updating...</span> <!-- Display blinkingDots here -->
</button>
</div>
</div>
Expand Down Expand Up @@ -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/`;
Expand All @@ -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');
Expand Down Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
};

Expand Down
Loading