feat(client): regenerate openapi types
This commit is contained in:
		@@ -1,5 +1,5 @@
 | 
			
		||||
import axios from 'axios';
 | 
			
		||||
import { Access, Auth } from '../types/auth';
 | 
			
		||||
import { Auth, Tokens } from '../types/auth';
 | 
			
		||||
import { User } from '../types/user';
 | 
			
		||||
import { AuthService } from '../services/authService';
 | 
			
		||||
import axiosRetry from 'axios-retry';
 | 
			
		||||
@@ -70,23 +70,16 @@ base.interceptors.response.use(
 | 
			
		||||
  }
 | 
			
		||||
);
 | 
			
		||||
 | 
			
		||||
interface newAccess {
 | 
			
		||||
  accessToken: string;
 | 
			
		||||
  refreshToken: string;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
const api = {
 | 
			
		||||
  // auth
 | 
			
		||||
  // async login(auth: Auth): Promise<Access> {
 | 
			
		||||
  async login(auth: Auth): Promise<newAccess> {
 | 
			
		||||
    // const response = (await base.post) <Access> ('/auth', auth);
 | 
			
		||||
    const response = await base.post<newAccess>('/auth', auth);
 | 
			
		||||
  async login(auth: Auth): Promise<Tokens> {
 | 
			
		||||
    const response = await base.post<Tokens>('/auth', auth);
 | 
			
		||||
    return response.data;
 | 
			
		||||
  },
 | 
			
		||||
 | 
			
		||||
  async refreshToken(): Promise<Access> {
 | 
			
		||||
  async refreshToken(): Promise<Tokens> {
 | 
			
		||||
    const token = localStorage.getItem('refreshToken');
 | 
			
		||||
    const response = await base.post<Access>(
 | 
			
		||||
    const response = await base.post<Tokens>(
 | 
			
		||||
      '/auth/refresh',
 | 
			
		||||
      {},
 | 
			
		||||
      {
 | 
			
		||||
 
 | 
			
		||||
@@ -8,7 +8,7 @@ export class AuthService {
 | 
			
		||||
  static async login(auth: Auth) {
 | 
			
		||||
    const token = await api.login(auth);
 | 
			
		||||
    useAuthStore.getState().setAccessToken(token.accessToken);
 | 
			
		||||
    localStorage.setItem('refreshToken', token.refreshToken);
 | 
			
		||||
    localStorage.setItem('refreshToken', token.refreshToken as string);
 | 
			
		||||
    await UserService.getProfile().then((user) => {
 | 
			
		||||
      useUserStore.getState().setUser(user);
 | 
			
		||||
    });
 | 
			
		||||
 
 | 
			
		||||
@@ -1,4 +1,4 @@
 | 
			
		||||
import { components } from './openapi-types';
 | 
			
		||||
 | 
			
		||||
export type Auth = components['schemas']['Auth'];
 | 
			
		||||
export type Access = components['schemas']['Access'];
 | 
			
		||||
export type Tokens = components['schemas']['Tokens'];
 | 
			
		||||
 
 | 
			
		||||
@@ -120,11 +120,6 @@ export interface paths {
 | 
			
		||||
export type webhooks = Record<string, never>;
 | 
			
		||||
export interface components {
 | 
			
		||||
    schemas: {
 | 
			
		||||
        /** Access */
 | 
			
		||||
        Access: {
 | 
			
		||||
            /** Accesstoken */
 | 
			
		||||
            accessToken: string;
 | 
			
		||||
        };
 | 
			
		||||
        /** AccountKeyring */
 | 
			
		||||
        AccountKeyring: {
 | 
			
		||||
            /** Ownerid */
 | 
			
		||||
@@ -219,6 +214,13 @@ export interface components {
 | 
			
		||||
         * @enum {string}
 | 
			
		||||
         */
 | 
			
		||||
        KeyType: "PASSWORD" | "ACCESS_TOKEN" | "REFRESH_TOKEN" | "API_KEY";
 | 
			
		||||
        /** Tokens */
 | 
			
		||||
        Tokens: {
 | 
			
		||||
            /** Accesstoken */
 | 
			
		||||
            accessToken: string;
 | 
			
		||||
            /** Refreshtoken */
 | 
			
		||||
            refreshToken?: string | null;
 | 
			
		||||
        };
 | 
			
		||||
        /** User */
 | 
			
		||||
        User: {
 | 
			
		||||
            /** Id */
 | 
			
		||||
@@ -305,7 +307,7 @@ export interface operations {
 | 
			
		||||
                    [name: string]: unknown;
 | 
			
		||||
                };
 | 
			
		||||
                content: {
 | 
			
		||||
                    "application/json": components["schemas"]["Access"];
 | 
			
		||||
                    "application/json": components["schemas"]["Tokens"];
 | 
			
		||||
                };
 | 
			
		||||
            };
 | 
			
		||||
            /** @description Validation Error */
 | 
			
		||||
@@ -334,7 +336,7 @@ export interface operations {
 | 
			
		||||
                    [name: string]: unknown;
 | 
			
		||||
                };
 | 
			
		||||
                content: {
 | 
			
		||||
                    "application/json": components["schemas"]["Access"];
 | 
			
		||||
                    "application/json": components["schemas"]["Tokens"];
 | 
			
		||||
                };
 | 
			
		||||
            };
 | 
			
		||||
        };
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user