mirror of
https://gitlab.com/mbugroup/lti-web-client.git
synced 2026-05-22 06:15:47 +00:00
Merge branch 'development' of gitlab.com:mbugroup/lti-web-client into feat/FE/US-282/TASK-318-319-slicing-and-adjustment-egg-grading-form
This commit is contained in:
@@ -20,10 +20,11 @@ export class ClosingApiService extends BaseApiService<Closing, null, null> {
|
||||
id: number
|
||||
): Promise<BaseApiResponse<ClosingSales> | undefined> {
|
||||
try {
|
||||
const getPenjualanPath = `${id}/penjualan`;
|
||||
return await this.customRequest<BaseApiResponse<ClosingSales>>(
|
||||
getPenjualanPath
|
||||
);
|
||||
const getPenjualanPath = `${this.basePath}/${id}/penjualan`;
|
||||
const getPenjualanRes =
|
||||
await httpClient<BaseApiResponse<ClosingSales>>(getPenjualanPath);
|
||||
|
||||
return getPenjualanRes;
|
||||
} catch (error) {
|
||||
if (axios.isAxiosError<BaseApiResponse<ClosingSales>>(error)) {
|
||||
return error.response?.data;
|
||||
|
||||
@@ -2,6 +2,8 @@ import axios from 'axios';
|
||||
import type { AxiosError, AxiosRequestConfig } from 'axios';
|
||||
import { RequestOptions } from '@/services/http/base';
|
||||
|
||||
import { redirectToSSO } from '@/lib/auth-helper';
|
||||
|
||||
const BASE_URL = process.env.NEXT_PUBLIC_API_BASE_URL ?? '';
|
||||
const axiosClient = axios.create({ baseURL: BASE_URL, timeout: 10_000 });
|
||||
|
||||
@@ -9,8 +11,7 @@ axiosClient.interceptors.response.use(
|
||||
(response) => response,
|
||||
(error: AxiosError) => {
|
||||
if (error.response?.status === 401) {
|
||||
const ssoLoginUrl = `${process.env.NEXT_PUBLIC_SSO_LOGIN_URL as string}?redirect_url=${window.location.href}`;
|
||||
window.location.href = ssoLoginUrl;
|
||||
redirectToSSO();
|
||||
}
|
||||
|
||||
return Promise.reject(error);
|
||||
|
||||
Reference in New Issue
Block a user