Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
web2022
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
JIRA
JIRA
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Website
web2022
Commits
f5b47853
Commit
f5b47853
authored
Jul 04, 2022
by
mxm-web-develop
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
321
parent
caf60b8a
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
23 additions
and
30 deletions
+23
-30
axios.ts
src/fetch/axios.ts
+3
-8
index.ts
src/fetch/index.ts
+0
-22
index.tsx
src/fetch/index.tsx
+20
-0
No files found.
src/fetch/axios.ts
View file @
f5b47853
...
...
@@ -11,14 +11,9 @@ export const axiosRequestConfiguration: AxiosRequestConfig = {
},
};
const
initialization
=
(
config
:
AxiosRequestConfig
):
AxiosInstance
=>
{
export
const
initialization
=
(
config
:
AxiosRequestConfig
):
AxiosInstance
=>
{
const
axiosInstance
=
axios
.
create
(
config
);
/*
Add default headers, interceptors etc..
*/
return
axiosInstance
;
};
export
default
initialization
;
\ No newline at end of file
// export default initialization;
\ No newline at end of file
src/fetch/index.ts
deleted
100644 → 0
View file @
caf60b8a
import
{
of
}
from
'rxjs'
import
{
ajax
}
from
"rxjs/ajax"
import
{
map
,
catchError
}
from
'rxjs/operators'
import
axios
,{
AxiosRequestConfig
,
AxiosInstance
,
AxiosPromise
}
from
'axios'
;
export
const
baseURL
=
import
.
meta
.
env
.
VITE_FETCH_URL
export
const
axiosRequestConfiguration
:
AxiosRequestConfig
=
{
baseURL
,
responseType
:
'json'
,
headers
:
{
'Content-Type'
:
'application/json'
,
},
};
// const observable$ = ajax.getJSON(url)
// .pipe(
// map(response => response),
// catchError(error => of(error))
// )
\ No newline at end of file
src/fetch/index.tsx
0 → 100644
View file @
f5b47853
import
{
of
,
BehaviorSubject
}
from
'rxjs'
import
{
ajax
}
from
"rxjs/ajax"
import
{
map
,
catchError
}
from
'rxjs/operators'
import
axios
,{
AxiosRequestConfig
,
AxiosInstance
,
AxiosPromise
}
from
'axios'
;
import
{
axiosRequestConfiguration
,
initialization
}
from
'./axios'
;
// export const baseURL = import.meta.env.VITE_FETCH_URL
// export const axiosRequestConfiguration: AxiosRequestConfig = {
// baseURL,
// responseType: 'json',
// headers: {
// 'Content-Type': 'application/json',
// },
// };
const
axiosInstance
=
(
options
:
AxiosRequestConfig
)
=>
initialization
(
Object
.
assign
(
axiosRequestConfiguration
,
options
))(
options
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment