I want to hide some div if user not logged in, this class gonna be exported to next JS file. So I make this code inside my javascript class to hide it if user not logged in. Otherwise, it's not showing:
class DisasterData {
static async getAllDisaster() {
...
if (marker.longitude !== null && marker.latitude !== null) {
if (shouldSkip) {
return;
}
if(true) {
...
<button type="submit"
class="popup-disaster-delete-button"
id="delete-button-${marker.id_logs}" data-id="${marker.id_logs}">Delete</button><br><br>
<button type="submit"
class="popup-disaster-update-button"
id="update-button-${marker.id_logs}" data-id="${marker.id_logs}" data-status="${marker.status} style="<?php
if(isset($_SESSION["login"])){
echo 'display:block;';
}
else{
echo 'display:none;';
}
?>">Update</button>
</div>
`;
...
});
return markers;
}
}
export default DisasterData;
It not showing me error, but not working properly as checking if user logged in or not.
Anyways to hide it?