mirror of
https://gitlab.com/mbugroup/lti-web-client.git
synced 2026-05-20 13:32:00 +00:00
chore: create AuthApiService
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
import axios from 'axios';
|
||||
import { httpClient } from '@/services/http/client';
|
||||
import { BaseApiResponse, LogoutResponse } from '@/types/api/api-general';
|
||||
|
||||
export class AuthApiService {
|
||||
async logout() {
|
||||
try {
|
||||
const logoutRes = await httpClient<LogoutResponse>(`/sso/logout`, {
|
||||
method: 'POST',
|
||||
});
|
||||
|
||||
return logoutRes;
|
||||
} catch (error) {
|
||||
if (axios.isAxiosError<BaseApiResponse>(error)) {
|
||||
return error.response?.data;
|
||||
}
|
||||
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export const AuthApi = new AuthApiService();
|
||||
|
||||
Reference in New Issue
Block a user