From 33962f0b9650b32d1ee313a06cefc9f81b910e4c Mon Sep 17 00:00:00 2001
From: Santo Cariotti <santo@dcariotti.me>
Date: Sat, 24 Sep 2022 19:31:24 +0200
Subject: Prevent glitch on not authorized pages

---
 pages/models/_id/edit.vue | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

(limited to 'pages/models/_id/edit.vue')

diff --git a/pages/models/_id/edit.vue b/pages/models/_id/edit.vue
index 7b8155e..8ced3e2 100644
--- a/pages/models/_id/edit.vue
+++ b/pages/models/_id/edit.vue
@@ -42,9 +42,10 @@ export default {
         if (response.status != 200) {
           window.location.href = "/models";
         } else {
-          this.model = response.data;
-          if (!(this.model.author_id == this.me.id || this.me.is_staff)) {
+          if (!(response.data.author_id == this.me.id || this.me.is_staff)) {
             window.location.href = "/models/" + this.id;
+          } else {
+            this.model = response.data;
           }
         }
       });
-- 
cgit v1.2.3-71-g8e6c

