♻️ Refactor key names to use contstants

This commit is contained in:
Alicia Sykes
2021-11-07 22:55:06 +00:00
parent 7e6cce8828
commit c991a46298
5 changed files with 28 additions and 19 deletions

View File

@@ -76,7 +76,7 @@ import router from '@/router';
import Button from '@/components/FormElements/Button';
import Input from '@/components/FormElements/Input';
import Defaults, { localStorageKeys } from '@/utils/defaults';
import { InfoHandler, WarningInfoHandler } from '@/utils/ErrorHandler';
import { InfoHandler, WarningInfoHandler, InfoKeys } from '@/utils/ErrorHandler';
import {
checkCredentials,
login,
@@ -158,9 +158,9 @@ export default {
if (response.correct) { // Yay, credentials were correct :)
login(this.username, this.password, timeout); // Login, to set the cookie
this.goHome();
InfoHandler(`Succesfully signed in as ${this.username}`, 'Authentication');
InfoHandler(`Succesfully signed in as ${this.username}`, InfoKeys.AUTH);
} else {
WarningInfoHandler('Unable to Sign In', 'Authentication', this.message);
WarningInfoHandler('Unable to Sign In', InfoKeys.AUTH, this.message);
}
},
/* Calls function to double-check guest access enabled, then log in as guest */
@@ -168,11 +168,11 @@ export default {
const isAllowed = this.isGuestAccessEnabled;
if (isAllowed) {
this.$toasted.show('Logged in as Guest, Redirecting...', { className: 'toast-success' });
InfoHandler('Logged in as Guest', 'Authentication');
InfoHandler('Logged in as Guest', InfoKeys.AUTH);
this.goHome();
} else {
this.$toasted.show('Guest Access Not Allowed', { className: 'toast-error' });
WarningInfoHandler('Guest Access Not Allowed', 'Authentication');
WarningInfoHandler('Guest Access Not Allowed', InfoKeys.AUTH);
}
},
/* Calls logout, shows status message, and refreshed page */