Code on demand
Code on demand is where the backend server directly executes code on the frontend. This constraint is optional and not widely used. However, it can be useful as it gives the backend server the right to decide as and when code is executed on the frontend. We have already been doing this; in our logout view, we directly execute JavaScript on the frontend by simply returning it in a string. This is done in the src/views/auth/logout.rs
file. We must remember that we have now added to-do items to our local storage. If we do not remove these items from our local storage when logging out, somebody else would be able to access our to-do items if they manage to log in to their own account on the same computer within 2 minutes. While this is highly unlikely, we might as well be safe. Remember that our logout view in the src/views/auth/logout.rs
file takes the following form:
pub async fn logout() -> HttpResponse { HttpResponse::Ok() &...