-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[build] fixed indentations, removed redundant comments
- Loading branch information
Showing
17 changed files
with
159 additions
and
175 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 |
---|---|---|
@@ -1,23 +1,24 @@ | ||
export const chatCompletion = async (keywords) => { | ||
const fetchUrl = `${process.env.NEXT_PUBLIC_LAMBDA_URL}/chat-completion`; | ||
|
||
try { | ||
const response = await fetch(fetchUrl, { | ||
method: 'POST', | ||
mode: 'cors', | ||
headers: { | ||
'Content-Type': 'application/json', | ||
}, | ||
body: JSON.stringify({ keywords }), | ||
}); | ||
|
||
if (!response.ok) { | ||
return null; | ||
} | ||
const data = await response.json(); | ||
return data; | ||
} catch (error) { | ||
console.log(error); | ||
const fetchUrl = `${process.env.NEXT_PUBLIC_LAMBDA_URL}/chat-completion`; | ||
|
||
try { | ||
const response = await fetch(fetchUrl, { | ||
method: 'POST', | ||
mode: 'cors', | ||
headers: { | ||
'Content-Type': 'application/json', | ||
}, | ||
body: JSON.stringify({ keywords }), | ||
}); | ||
|
||
if (!response.ok) { | ||
return null; | ||
} | ||
}; | ||
|
||
const data = await response.json(); | ||
return data; | ||
} catch (error) { | ||
console.log(error); | ||
return null; | ||
} | ||
}; |
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 |
---|---|---|
@@ -1,31 +1,29 @@ | ||
export const connectDiary = async ({ diaryId, credentials }) => { | ||
const fetchUrl = `${process.env.NEXT_PUBLIC_LAMBDA_URL}/connect-diary`; | ||
|
||
try { | ||
const response = await fetch(fetchUrl, { | ||
method: 'POST', | ||
mode: 'cors', | ||
headers: { | ||
'Content-Type': 'application/json', | ||
}, | ||
body: JSON.stringify({ | ||
diaryId: diaryId, | ||
connected: '1', | ||
user2: credentials.email, | ||
user2Name: credentials.name, | ||
}), | ||
}); | ||
const fetchUrl = `${process.env.NEXT_PUBLIC_LAMBDA_URL}/connect-diary`; | ||
|
||
if (!response.ok) { | ||
console.error('Failed to create diary:', response.status); | ||
try { | ||
const response = await fetch(fetchUrl, { | ||
method: 'POST', | ||
mode: 'cors', | ||
headers: { | ||
'Content-Type': 'application/json', | ||
}, | ||
body: JSON.stringify({ | ||
diaryId: diaryId, | ||
connected: '1', | ||
user2: credentials.email, | ||
user2Name: credentials.name, | ||
}), | ||
}); | ||
|
||
if (!response.ok) { | ||
return null; | ||
} | ||
|
||
console.log('Diary connected successfully!'); | ||
return await response.json(); // Return the response if needed | ||
} catch (error) { | ||
console.error('Error during diary creation:', error); | ||
return null; // Handle errors gracefully | ||
} | ||
}; | ||
|
||
return await response.json(); | ||
} catch (error) { | ||
console.error('Error during diary creation:', error); | ||
return null; | ||
} | ||
}; | ||
|
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 |
---|---|---|
@@ -1,23 +1,23 @@ | ||
export const extractLabels = async (s3_url) => { | ||
const fetchUrl = `${process.env.NEXT_PUBLIC_LAMBDA_URL}/extract-labels`; | ||
|
||
try { | ||
const response = await fetch(fetchUrl, { | ||
method: 'POST', | ||
mode: 'cors', | ||
headers: { | ||
'Content-Type': 'application/json', | ||
}, | ||
body: JSON.stringify({ s3_url }), | ||
}); | ||
|
||
if (!response.ok) { | ||
return null; | ||
} | ||
const data = await response.json(); | ||
return data; | ||
} catch (error) { | ||
console.log(error); | ||
const fetchUrl = `${process.env.NEXT_PUBLIC_LAMBDA_URL}/extract-labels`; | ||
|
||
try { | ||
const response = await fetch(fetchUrl, { | ||
method: 'POST', | ||
mode: 'cors', | ||
headers: { | ||
'Content-Type': 'application/json', | ||
}, | ||
body: JSON.stringify({ s3_url }), | ||
}); | ||
|
||
if (!response.ok) { | ||
return null; | ||
} | ||
}; | ||
const data = await response.json(); | ||
return data; | ||
} catch (error) { | ||
console.log(error); | ||
return null; | ||
} | ||
}; |
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 |
---|---|---|
@@ -1,27 +1,27 @@ | ||
export const readDiary = async ({ diaryInfo }) => { | ||
const fetchUrl = `${process.env.NEXT_PUBLIC_LAMBDA_URL}/read-diary`; | ||
|
||
try { | ||
const response = await fetch(fetchUrl, { | ||
method: 'POST', | ||
mode: 'cors', | ||
headers: { | ||
'Content-Type': 'application/json', | ||
}, | ||
body: JSON.stringify({ | ||
diaryId: diaryInfo.diaryId, | ||
}), | ||
}); | ||
const fetchUrl = `${process.env.NEXT_PUBLIC_LAMBDA_URL}/read-diary`; | ||
|
||
if (!response.ok) { | ||
console.error('Failed to write diary:', response.status); | ||
return null; | ||
} | ||
|
||
return await response.json(); // Return the response if needed | ||
} catch (error) { | ||
console.error('Error during diary writting:', error); | ||
return null; // Handle errors gracefully | ||
try { | ||
const response = await fetch(fetchUrl, { | ||
method: 'POST', | ||
mode: 'cors', | ||
headers: { | ||
'Content-Type': 'application/json', | ||
}, | ||
body: JSON.stringify({ | ||
diaryId: diaryInfo.diaryId, | ||
}), | ||
}); | ||
|
||
if (!response.ok) { | ||
console.error('Failed to write diary:', response.status); | ||
return null; | ||
} | ||
}; | ||
|
||
return await response.json(); | ||
} catch (error) { | ||
console.error('Error during diary writting:', error); | ||
return null; | ||
} | ||
}; | ||
|
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 |
---|---|---|
@@ -1,31 +1,31 @@ | ||
export const writeDiary = async ({ diaryInfo, credentials, s3_url, keywords }) => { | ||
const fetchUrl = `${process.env.NEXT_PUBLIC_LAMBDA_URL}/write-diary`; | ||
|
||
try { | ||
const response = await fetch(fetchUrl, { | ||
method: 'POST', | ||
mode: 'cors', | ||
headers: { | ||
'Content-Type': 'application/json', | ||
}, | ||
body: JSON.stringify({ | ||
diaryId: diaryInfo.diaryId, | ||
labels: keywords, | ||
s3_url: s3_url, | ||
email: credentials.email, | ||
name: credentials.name, | ||
}), | ||
}); | ||
const fetchUrl = `${process.env.NEXT_PUBLIC_LAMBDA_URL}/write-diary`; | ||
|
||
if (!response.ok) { | ||
console.error('Failed to write diary:', response.status); | ||
return null; | ||
} | ||
|
||
return await response.json(); // Return the response if needed | ||
} catch (error) { | ||
console.error('Error during diary writting:', error); | ||
return null; // Handle errors gracefully | ||
try { | ||
const response = await fetch(fetchUrl, { | ||
method: 'POST', | ||
mode: 'cors', | ||
headers: { | ||
'Content-Type': 'application/json', | ||
}, | ||
body: JSON.stringify({ | ||
diaryId: diaryInfo.diaryId, | ||
labels: keywords, | ||
s3_url: s3_url, | ||
email: credentials.email, | ||
name: credentials.name, | ||
}), | ||
}); | ||
|
||
if (!response.ok) { | ||
console.error('Failed to write diary:', response.status); | ||
return null; | ||
} | ||
}; | ||
|
||
return await response.json(); | ||
} catch (error) { | ||
console.error('Error during diary writting:', error); | ||
return null; | ||
} | ||
}; | ||
|
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
Oops, something went wrong.