-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #600 from 1ifeworld/jawn/straightfromdb
new route
- Loading branch information
Showing
3 changed files
with
35 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
export async function getUserDataByOwner({ owner }: { owner: string }) { | ||
if (!owner) { | ||
throw new Error('owner is required') | ||
} | ||
|
||
try { | ||
const response = await fetch( | ||
`${process.env.NEXT_PUBLIC_USERNAME_SERVICE}/getDataByOwner`, | ||
{ | ||
method: 'POST', | ||
headers: { | ||
'Content-Type': 'application/json', | ||
}, | ||
body: JSON.stringify({ owner }), | ||
}, | ||
) | ||
|
||
if (!response.ok) { | ||
throw new Error('Network response was not ok') | ||
} | ||
|
||
const data = await response.json() | ||
return data | ||
} catch (error) { | ||
console.error('Fetch error:', error) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters