mirror of
https://github.com/Spythere/station-manager-2.0.git
synced 2026-05-03 05:28:13 +00:00
hotfix: login sate
This commit is contained in:
@@ -15,6 +15,7 @@
|
||||
<input type="password" id="password" v-model="password" />
|
||||
<br />
|
||||
<button>{{ loginState == LoginState.LOADING ? 'Logowanie...' : 'Zaloguj się' }}</button>
|
||||
{{ loginState }}
|
||||
</form>
|
||||
<p style="color: yellow; height: 25px">{{ errorMessage }}</p>
|
||||
</div>
|
||||
@@ -39,6 +40,7 @@ export default defineComponent({
|
||||
data() {
|
||||
return {
|
||||
errorMessage: '',
|
||||
loginState: LoginState.INITIALIZED,
|
||||
};
|
||||
},
|
||||
|
||||
@@ -49,7 +51,6 @@ export default defineComponent({
|
||||
|
||||
name: '',
|
||||
password: '',
|
||||
loginState: LoginState.INITIALIZED,
|
||||
store: useStore(),
|
||||
};
|
||||
},
|
||||
@@ -58,6 +59,7 @@ export default defineComponent({
|
||||
async signIn(e: Event) {
|
||||
e.preventDefault();
|
||||
this.loginState = LoginState.LOADING;
|
||||
console.log('Ładowanie');
|
||||
|
||||
try {
|
||||
const data: ILoginResponse = (
|
||||
@@ -81,8 +83,10 @@ export default defineComponent({
|
||||
window.localStorage.setItem('auth-token', this.store.token);
|
||||
window.localStorage.setItem('user', JSON.stringify(this.store.user));
|
||||
|
||||
this.loadData();
|
||||
console.log('Gituwa');
|
||||
|
||||
this.$router.push('/');
|
||||
this.loadData();
|
||||
} catch (e: any) {
|
||||
this.store.authState = AuthState.UNAUTHORIZED;
|
||||
this.loginState = LoginState.LOADED;
|
||||
|
||||
Reference in New Issue
Block a user