@@ -28,15 +28,15 @@ To keep sessions alive, refresh the token just before its expiration and reconne
2828 ``` jsx
2929 const { control } = useChatKit ({
3030 api: {
31- getClientSecret (currentClientSecret ) {
31+ async getClientSecret (currentClientSecret ) {
3232 if (! currentClientSecret) {
3333 const res = await fetch (' /api/chatkit/start' , { method: ' POST' })
3434 const {client_secret } = await res .json ();
3535 return client_secret
3636 }
3737 const res = await fetch (' /api/chatkit/refresh' , {
3838 method: ' POST' ,
39- body: JSON .stringify ({ currentClientSecret })
39+ body: JSON .stringify ({ currentClientSecret }),
4040 headers: {
4141 ' Content-Type' : ' application/json' ,
4242 },
@@ -57,15 +57,15 @@ To keep sessions alive, refresh the token just before its expiration and reconne
5757
5858 chatkit .setOptions ({
5959 api: {
60- getClientSecret (currentClientSecret ) {
60+ async getClientSecret (currentClientSecret ) {
6161 if (! currentClientSecret) {
6262 const res = await fetch (' /api/chatkit/start' , { method: ' POST' })
6363 const {client_secret } = await res .json ();
6464 return client_secret
6565 }
6666 const res = await fetch (' /api/chatkit/refresh' , {
6767 method: ' POST' ,
68- body: JSON .stringify ({ currentClientSecret })
68+ body: JSON .stringify ({ currentClientSecret }),
6969 headers: {
7070 ' Content-Type' : ' application/json' ,
7171 },
0 commit comments