Add barebones UI version tracking
This commit is contained in:
parent
69126440d3
commit
cf79c335c2
|
@ -504,6 +504,7 @@ class UserSerializer(serializers.ModelSerializer):
|
|||
transactions = serializers.SerializerMethodField()
|
||||
door_code = serializers.SerializerMethodField()
|
||||
wifi_pass = serializers.SerializerMethodField()
|
||||
app_version = serializers.SerializerMethodField()
|
||||
|
||||
class Meta:
|
||||
model = User
|
||||
|
@ -517,6 +518,7 @@ class UserSerializer(serializers.ModelSerializer):
|
|||
'is_staff',
|
||||
'door_code',
|
||||
'wifi_pass',
|
||||
'app_version',
|
||||
#'usages',
|
||||
]
|
||||
depth = 1
|
||||
|
@ -541,6 +543,9 @@ class UserSerializer(serializers.ModelSerializer):
|
|||
else:
|
||||
return None
|
||||
|
||||
def get_app_version(self, obj):
|
||||
return settings.APP_VERSION
|
||||
|
||||
|
||||
class MyRegisterSerializer(RegisterSerializer):
|
||||
first_name = serializers.CharField(max_length=32)
|
||||
|
|
|
@ -282,5 +282,7 @@ DEFAULT_FROM_EMAIL = 'Protospace Portal <portal@mg.protospace.ca>'
|
|||
if DEBUG: logger.info('Debug mode ON')
|
||||
logger.info('Test logging for each thread')
|
||||
|
||||
APP_VERSION = 1 # TODO: automate this
|
||||
|
||||
#import logging_tree
|
||||
#logging_tree.printout()
|
||||
|
|
|
@ -27,6 +27,8 @@ import { PasswordReset, ConfirmReset } from './PasswordReset.js';
|
|||
import { NotFound, PleaseLogin } from './Misc.js';
|
||||
import { Footer } from './Footer.js';
|
||||
|
||||
const APP_VERSION = 1; // TODO: automate this
|
||||
|
||||
function App() {
|
||||
const [token, setToken] = useState(localStorage.getItem('token', ''));
|
||||
const [user, setUser] = useState(JSON.parse(localStorage.getItem('user', 'false')));
|
||||
|
@ -98,6 +100,11 @@ function App() {
|
|||
darkmode.showWidget();
|
||||
}, []);
|
||||
|
||||
if (user && user?.app_version !== APP_VERSION) {
|
||||
setUserCache(false);
|
||||
window.location.reload();
|
||||
}
|
||||
|
||||
return (
|
||||
<div>
|
||||
<ManageScroll />
|
||||
|
|
Loading…
Reference in New Issue
Block a user