diff --git a/web/src/persistent-state-plugin/index.js b/web/src/persistent-state-plugin/index.js index 14f5577..b7cff69 100644 --- a/web/src/persistent-state-plugin/index.js +++ b/web/src/persistent-state-plugin/index.js @@ -20,9 +20,6 @@ export default (config) => (store) => { } }); store.state[config.isLoadedKey] = true; - if ('validate' in config) { - config.validate(store.state); - } } const reload = initialize; diff --git a/web/src/store.js b/web/src/store.js index fa86f94..aa4820d 100644 --- a/web/src/store.js +++ b/web/src/store.js @@ -515,15 +515,6 @@ const store = createStore({ prefix: "lf_", debug: false, isLoadedKey: "persistent_loaded", - validate: (state) => { - if (state.user && state.user.expiry && state.user.token) { - const as_date = new Date(state.user.expiry); - if (as_date < new Date()) { - state.user.token = null; - state.user.expiry = null; - } - } - }, state: ["remember", "user", "events", "lastUsed",] }), sharedStatePlugin({ debug: false, diff --git a/web/src/utils.js b/web/src/utils.js index d753623..ebc911a 100644 --- a/web/src/utils.js +++ b/web/src/utils.js @@ -1,5 +1,3 @@ -import store from '@/store' - function ticketStateColorLookup(ticket) { if (ticket.startsWith('closed_')) { return 'secondary'; @@ -38,8 +36,6 @@ const http = { "Authorization": `Token ${token}`, }, }); - if (response.status === 401) - throw {http_status: response.status}; const success = response.status === 200 || response.status === 201; return {data: await response.json() || {}, success}; }, @@ -55,8 +51,6 @@ const http = { }, body: JSON.stringify(data), }); - if (response.status === 401) - throw {http_status: response.status}; const success = response.status === 200 || response.status === 201; return {data: await response.json() || {}, success}; }, @@ -72,8 +66,6 @@ const http = { }, body: JSON.stringify(data), }); - if (response.status === 401) - throw {http_status: response.status}; const success = response.status === 200 || response.status === 201; return {data: await response.json() || {}, success}; }, @@ -89,8 +81,6 @@ const http = { }, body: JSON.stringify(data), }); - if (response.status === 401) - throw {http_status: response.status}; const success = response.status === 200 || response.status === 201; return {data: await response.json() || {}, success}; }, @@ -105,34 +95,17 @@ const http = { "Authorization": `Token ${token}`, }, }); - if (response.status === 401) - throw {http_status: response.status}; const success = response.status === 204; return {data: await response.text() || {}, success}; } } const http_session = token => ({ - get: async (url) => await http.get(url, token).catch((e) => { - if (e.http_status === 401) store.commit('logout'); - return {data: {}, success: false}; - }), - post: async (url, data) => await http.post(url, data, token).catch((e) => { - if (e.http_status === 401) store.commit('logout'); - return {data: {}, success: false}; - }), - put: async (url, data) => await http.put(url, data, token).catch((e) => { - if (e.http_status === 401) store.commit('logout'); - return {data: {}, success: false}; - }), - patch: async (url, data) => await http.patch(url, data, token).catch((e) => { - if (e.http_status === 401) store.commit('logout'); - return {data: {}, success: false}; - }), - delete: async (url) => await http.delete(url, token).catch((e) => { - if (e.http_status === 401) store.commit('logout'); - return {data: {}, success: false}; - }), + get: async (url) => await http.get(url, token), + post: async (url, data) => await http.post(url, data, token), + put: async (url, data) => await http.put(url, data, token), + patch: async (url, data) => await http.patch(url, data, token), + delete: async (url) => await http.delete(url, token), }); export {ticketStateColorLookup, ticketStateIconLookup, http, http_session}; \ No newline at end of file diff --git a/web/src/views/Login.vue b/web/src/views/Login.vue index d002cc6..8cff6c2 100644 --- a/web/src/views/Login.vue +++ b/web/src/views/Login.vue @@ -72,7 +72,7 @@ export default { name: 'Login', data() { return { - msg: 'Lost&Found Team Login', + msg: 'Welcome to ' + window.location.hostname, username: '', password: '', remember: false diff --git a/web/src/views/Register.vue b/web/src/views/Register.vue index 15412f7..11ed693 100644 --- a/web/src/views/Register.vue +++ b/web/src/views/Register.vue @@ -87,7 +87,7 @@ export default { name: 'Register', data() { return { - msg: 'Register as team member', + msg: 'Register', password2: '', form: { username: '',