Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
bodysch-frontend
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
JetBrains YouTrack
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
KSZK
DevTeam
org
BodySCH
bodysch-frontend
Commits
0a6e502b
Commit
0a6e502b
authored
4 years ago
by
Chif Gergő
Browse files
Options
Downloads
Patches
Plain Diff
Add news list client function
parent
7cf04a55
No related branches found
No related tags found
1 merge request
!19
fix type imports
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/client/news.ts
+28
-0
28 additions, 0 deletions
src/client/news.ts
with
28 additions
and
0 deletions
src/client/news.ts
0 → 100644
+
28
−
0
View file @
0a6e502b
import
Axios
,
{
AxiosRequestConfig
}
from
'
axios
'
;
import
{
INews
}
from
'
../types/News
'
;
type
NewsQuery
=
()
=>
Promise
<
INews
[]
>
;
export
type
NewsClient
=
{
news
:
NewsQuery
;
};
const
authToken
=
'
q98g7o6353wl7usv1a36xv6dieso6219
'
;
export
function
users
(
config
:
AxiosRequestConfig
):
NewsClient
{
const
axios
=
Axios
.
create
({
...
config
,
baseURL
:
`
${
config
.
baseURL
}
/api/v1/news`
,
});
const
news
:
NewsQuery
=
async
():
Promise
<
INews
[]
>
=>
{
const
{
data
:
response
}
=
await
axios
.
get
<
INews
[]
>
(
'
/
'
,
{
headers
:
{
Authorization
:
`Bearer
${
authToken
}
`
},
});
return
response
;
};
return
{
news
,
};
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment