Skip to content

Commit 25e9f5d

Browse files
committed
test
1 parent 7ecfcb5 commit 25e9f5d

File tree

2 files changed

+22
-14
lines changed

2 files changed

+22
-14
lines changed

.github/workflows/deploy.yml

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -30,18 +30,7 @@ jobs:
3030
if [ -d "$function" ]; then
3131
function_name=$(basename "$function")
3232
echo "Deploying function: $function_name"
33-
npx supabase functions deploy "$function_name" --project-ref ${{ secrets.SUPABASE_PROJECT_REF }}
34-
fi
35-
done
36-
37-
- name: Disable JWT Authentication for Functions
38-
run: |
39-
for function in supabase/functions/*; do
40-
if [ -d "$function" ]; then
41-
function_name=$(basename "$function")
42-
curl -X PUT "https://api.supabase.io/v1/projects/${{ secrets.SUPABASE_PROJECT_REF }}/functions/$function_name" \
43-
-H "Authorization: Bearer ${{ secrets.SUPABASE_ACCESS_TOKEN }}" \
44-
-d '{"jwt": false}'
33+
npx supabase functions deploy "$function_name" --project-ref ${{ secrets.SUPABASE_PROJECT_REF }} --disable-jwt
4534
fi
4635
done
4736

u/profile.html

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,31 @@
2424
document.addEventListener("DOMContentLoaded", async () => {
2525
const { data, error } = await supabase.auth.getUser();
2626

27-
/*if (!data.user) {
27+
if (!data.user) {
2828
window.location.href = "/u/login.html";
2929
return;
3030
} else if (error) {
3131
console.error(error);
32-
}*/
32+
}
33+
34+
const data = {
35+
user_id: userId
36+
};
37+
38+
fetch('https://jwpvozanqtemykhdqhvk.supabase.co/functions/v1/inituser', {
39+
method: 'POST',
40+
headers: {
41+
'Content-Type': 'application/json',
42+
},
43+
body: JSON.stringify(data)
44+
})
45+
.then(response => response.json())
46+
.then(data => {
47+
console.log('Function response:', data);
48+
})
49+
.catch((error) => {
50+
console.error('Error invoking function:', error);
51+
});
3352
});
3453

3554
initFooter();

0 commit comments

Comments
 (0)