Do not use a store for API

This commit is contained in:
2022-02-14 08:11:42 +00:00
parent ca93e9cd55
commit d11c0036b5
8 changed files with 43 additions and 56 deletions

View File

@ -1,6 +1,6 @@
import { StorageSerializers, useStorage } from '@vueuse/core';
import { defineStore } from 'pinia'
import { useAPI } from './api';
import { POST } from '../api';
interface State {
Session: Session | null
@ -40,14 +40,12 @@ export const useSessionStore = defineStore('session', {
this.Budgets = x.Budgets;
},
async login(login: any) {
const api = useAPI();
const response = await api.POST("/user/login", JSON.stringify(login));
const response = await POST("/user/login", JSON.stringify(login));
const result = await response.json();
return this.loginSuccess(result);
},
async register(login : any) {
const api = useAPI();
const response = await api.POST("/user/register", JSON.stringify(login));
const response = await POST("/user/register", JSON.stringify(login));
const result = await response.json();
return this.loginSuccess(result);
},