Skip to content

Commit

Permalink
Fix: Fix header for send request notification server
Browse files Browse the repository at this point in the history
  • Loading branch information
0hhanum committed Apr 3, 2024
1 parent 989c52d commit 0ba28ec
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 18 deletions.
32 changes: 17 additions & 15 deletions .github/scripts/firebase.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,23 +106,25 @@ const sendNotification = async (quizId, category) => {
}

for (const tokens of expoTokenBatches) {
const headers = new Headers();
headers.append("Content-Type", "application/json");
const data = JSON.stringify({
to: tokens,
sound: "default",
title: notificationTitle,
body: notificationSubtitle,
data: { quizId, category },
});
await fetch(notificationServerURL, {
method: "POST",
headers: {
Accept: "application/json",
"Accept-encoding": "gzip, deflate",
"Content-Type": "application/json",
},
data: {
to: tokens,
sound: "default",
title: notificationTitle,
body: notificationSubtitle,
data: { quizId, category },
},
}).then(() => {
console.log("Push notification sent successfully.");
});
headers,
data,
redirect: "follow",
})
.then((response) => response.text())
.then((result) => {
console.log("Push notification sent successfully.", result);
});
}
};

Expand Down
5 changes: 2 additions & 3 deletions contents/ts/utilityType.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ answer:
- A
level: 1
category: "ts"
description:
description:
- 스프레드 연산자를 사용한 것으로 보아 newData의 프로퍼티가 명확하지 않아요.
- 이런 경우 모든 프로퍼티를 옵셔널로 만드는게 적당해요.
- 업데이트 프로퍼티가 명확한 함수라면 Pick을 사용할 수 있어요.
- 업데이트 프로퍼티가 명확한 함수엔 Pick을 사용할 수 있어요.
---

# 유틸리티 타입?
Expand Down Expand Up @@ -177,4 +177,3 @@ const obj: Partial<Record<dataState, IData[]>> = {
pending: IData 타입의 객체 배열
} // fulfilled, error 프로퍼티가 없어도 OK.
```

0 comments on commit 0ba28ec

Please sign in to comment.