Appearance
User Logout
Properly handle user logout to maintain data integrity and privacy.
Basic Logout
javascript
const handleUserLogout = () => {
// Clear the user identity by setting appuID to empty
const logoutData = {
appuID: "",
};
Upshot.setUserProfile(JSON.stringify(logoutData), function (response) {
if (response) {
console.log("User logged out successfully");
} else {
console.error("Failed to logout user");
}
});
};Complete Profile Cleanup
For more thorough logout, you might want to clear specific user data:
javascript
const handleCompleteLogout = () => {
const logoutData = {
// Clear primary identity
appuID: "",
// Optionally clear sensitive data
email: "",
phone: "",
// Clear social media links if needed
facebookID: "",
twitterID: "",
linkedinID: "",
googleplusID: "",
// Update logout timestamp
lastLogoutDate: new Date().toISOString(),
};
Upshot.setUserProfile(JSON.stringify(logoutData), function (response) {
if (response) {
console.log("Complete logout successful");
}
});
};
