Bugfixes
This commit is contained in:
@ -1,4 +1,5 @@
|
||||
import { defineStore } from 'pinia'
|
||||
import { useAPI } from './api';
|
||||
|
||||
interface State {
|
||||
Token: string | null
|
||||
@ -33,17 +34,18 @@ export const useSessionStore = defineStore('session', {
|
||||
this.Token = x.Token;
|
||||
this.Budgets = x.Budgets;
|
||||
},
|
||||
login(login: any) {
|
||||
return fetch("/api/v1/user/login", { method: "POST", body: JSON.stringify(login) })
|
||||
.then(x => x.json())
|
||||
.then(x => this.loginSuccess(x));
|
||||
async login(login: any) {
|
||||
const api = useAPI();
|
||||
const response = await api.POST("/user/login", JSON.stringify(login));
|
||||
const result = await response.json();
|
||||
return this.loginSuccess(result);
|
||||
},
|
||||
register(login : any) {
|
||||
return fetch("/api/v1/user/register", { method: "POST", body: JSON.stringify(login) })
|
||||
.then(x => x.json())
|
||||
.then(x => this.loginSuccess(x))
|
||||
async register(login : any) {
|
||||
const api = useAPI();
|
||||
const response = await api.POST("/user/register", JSON.stringify(login));
|
||||
const result = await response.json();
|
||||
return this.loginSuccess(result);
|
||||
},
|
||||
// easily reset state using `$reset`
|
||||
logout() {
|
||||
this.$reset()
|
||||
}
|
||||
|
Reference in New Issue
Block a user