Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
G
GrowBros
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
tomato
GrowBros
Commits
8ad3129d
Commit
8ad3129d
authored
1 year ago
by
Karsch Lukas
Browse files
Options
Downloads
Patches
Plain Diff
#40
refactor: rename hook to "useGrowbrosFetcher" to avoid name clashing
parent
7827524d
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!28
Closes #40 : Custom useGrowbrosFetcher hook to make calls to the backend.
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
growbros-frontend/src/utils/BackendConnectorImpl.ts
+2
-2
2 additions, 2 deletions
growbros-frontend/src/utils/BackendConnectorImpl.ts
growbros-frontend/src/utils/useGrowbrosFetcher.ts
+2
-2
2 additions, 2 deletions
growbros-frontend/src/utils/useGrowbrosFetcher.ts
with
4 additions
and
4 deletions
growbros-frontend/src/utils/BackendConnectorImpl.ts
+
2
−
2
View file @
8ad3129d
...
...
@@ -90,7 +90,7 @@ export class BackendConnectorImpl implements IBackendConnector {
}
async
clearGarden
():
Promise
<
FetchResult
<
number
>>
{
let
result
:
FetchResult
<
number
>
=
{}
;
let
result
:
FetchResult
<
number
>
;
try
{
const
res
=
await
this
.
makeFetchWithAuthAndOptions
(
"
/garden/remove/all
"
,
{
method
:
"
DELETE
"
});
const
num
=
await
res
.
json
();
...
...
@@ -159,7 +159,7 @@ export class BackendConnectorImpl implements IBackendConnector {
}
async
clearWishlist
():
Promise
<
FetchResult
<
number
>>
{
let
result
:
FetchResult
<
number
>
=
{}
;
let
result
:
FetchResult
<
number
>
;
try
{
const
res
=
await
this
.
makeFetchWithAuthAndOptions
(
"
/wishlist/remove/all
"
,
{
method
:
"
DELETE
"
});
const
num
=
await
res
.
json
();
...
...
This diff is collapsed.
Click to expand it.
growbros-frontend/src/utils/useFetcher.ts
→
growbros-frontend/src/utils/use
Growbros
Fetcher.ts
+
2
−
2
View file @
8ad3129d
...
...
@@ -8,10 +8,10 @@ const createFetcherInstance = (): IBackendConnector => {
return
new
BackendConnectorImpl
(
backendUrl
);
};
const
useFetcher
=
():
IBackendConnector
=>
{
const
use
Growbros
Fetcher
=
():
IBackendConnector
=>
{
const
fetcherInstance
=
useMemo
(()
=>
createFetcherInstance
(),
[]);
return
fetcherInstance
;
};
export
default
useFetcher
;
export
default
use
Growbros
Fetcher
;
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