Skip to content

Commit fbdd919

Browse files
committed
refactor: use type keyword
1 parent b8f33e6 commit fbdd919

File tree

1 file changed

+17
-17
lines changed

1 file changed

+17
-17
lines changed

src/app.ts

+17-17
Original file line numberDiff line numberDiff line change
@@ -20,19 +20,19 @@ dotenv.config();
2020
* EmailSendedResponse adalah struktur response data balikan dari Gmail API
2121
* ketika email konfirmasi berhasil dikirim
2222
*/
23-
interface EmailSendedResponse {
24-
accepted: string[]
25-
rejected: string[]
26-
envelopeTime: number
27-
messageTime: number
28-
messageSize: number
29-
response: string
23+
type EmailSendedResponse = {
24+
accepted: string[];
25+
rejected: string[];
26+
envelopeTime: number;
27+
messageTime: number;
28+
messageSize: number;
29+
response: string;
3030
envelope: {
31-
from: string
32-
to: string[]
33-
}
34-
messageId: string
35-
}
31+
from: string;
32+
to: string[];
33+
};
34+
messageId: string;
35+
};
3636

3737
/*
3838
* RegConfirmBody adalah struktur request body yang akan dikirim oleh frontend
@@ -41,10 +41,10 @@ interface EmailSendedResponse {
4141
* Struktur RegConfirmBody disini HARUS MIRIP dengan
4242
* struktur RegConfirmBody yang ada di projek frontend
4343
*/
44-
interface RegConfirmBody {
45-
destEmail: string
46-
confirmationURL: string
47-
}
44+
type RegConfirmBody = {
45+
destEmail: string;
46+
confirmationURL: string;
47+
};
4848

4949
/*
5050
* Gmailer Middleware
@@ -58,7 +58,7 @@ interface RegConfirmBody {
5858
*/
5959
app.use(async (req, res) => {
6060
try {
61-
const { destEmail, confirmationURL } = (req.body as RegConfirmBody);
61+
const { destEmail, confirmationURL } = req.body as RegConfirmBody;
6262

6363
const emailTemplate = await ejs.renderFile(
6464
Path.join(__dirname, '/templates/confirmation.ejs'),

0 commit comments

Comments
 (0)