Skip to content

Commit

Permalink
Cache
Browse files Browse the repository at this point in the history
  • Loading branch information
pontusab committed Dec 18, 2023
1 parent f872560 commit b57ad07
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 3 deletions.
2 changes: 2 additions & 0 deletions apps/dashboard/src/actions/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ export async function sendFeeback(formData: FormData) {

const res = await fetch(`${baseUrl}/email`, {
method: "POST",
cache: "no-cache",
headers: {
Authorization: `Bearer ${env.RESEND_API_KEY}`,
"Content-Type": "application/json",
Expand All @@ -45,6 +46,7 @@ export async function subscribeEmail(formData: FormData, userGroup: string) {

const res = await fetch(env.LOOPS_ENDPOINT, {
method: "POST",
cache: "no-cache",
headers: {
"Content-Type": "application/json",
},
Expand Down
3 changes: 2 additions & 1 deletion apps/website/src/actions/subscribeEmail.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ export async function subscribeEmail(formData: FormData, userGroup: string) {
const res = await fetch(
"https://app.loops.so/api/newsletter-form/clna1p09j00d3l60og56gj3u1",
{
cache: "no-cache",
method: "POST",
headers: {
"Content-Type": "application/json",
Expand All @@ -19,7 +20,7 @@ export async function subscribeEmail(formData: FormData, userGroup: string) {
userGroup,
country,
}),
},
}
);

const json = await res.json();
Expand Down
12 changes: 12 additions & 0 deletions packages/gocardless/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ const keys = {
async function getRefreshToken(refresh: string) {
const res = await fetch(`${baseUrl}/api/v2/token/refresh/`, {
method: "POST",
cache: "no-cache",
headers: {
"Content-Type": "application/json",
},
Expand Down Expand Up @@ -55,6 +56,7 @@ async function getAccessToken() {

const res = await fetch(`${baseUrl}/api/v2/token/new/`, {
method: "POST",
cache: "no-cache",
headers: {
"Content-Type": "application/json",
},
Expand Down Expand Up @@ -86,6 +88,7 @@ export async function getBanks(countryCode: string) {
const res = await fetch(
`${baseUrl}/api/v2/institutions/?country=${countryCode.toLowerCase()}`,
{
cache: "no-cache",
method: "GET",
headers: {
"Content-Type": "application/json",
Expand All @@ -102,6 +105,7 @@ export async function createEndUserAgreement(institutionId: string) {

const res = await fetch(`${baseUrl}/api/v2/agreements/enduser/`, {
method: "POST",
cache: "no-cache",
headers: {
"Content-Type": "application/json",
Authorization: `Bearer ${token}`,
Expand Down Expand Up @@ -132,6 +136,7 @@ export async function buildLink({

const res = await fetch(`${baseUrl}/api/v2/requisitions/`, {
method: "POST",
cache: "no-cache",
headers: {
"Content-Type": "application/json",
Authorization: `Bearer ${token}`,
Expand All @@ -152,13 +157,15 @@ export async function getAccountDetails(id: string) {
const [account, details] = await Promise.all([
fetch(`${baseUrl}/api/v2/accounts/${id}/`, {
method: "GET",
cache: "no-cache",
headers: {
"Content-Type": "application/json",
Authorization: `Bearer ${token}`,
},
}),
fetch(`${baseUrl}/api/v2/accounts/${id}/details/`, {
method: "GET",
cache: "no-cache",
headers: {
"Content-Type": "application/json",
Authorization: `Bearer ${token}`,
Expand All @@ -180,6 +187,7 @@ export async function getAccountBalancesById(id: string) {

const account = await fetch(`${baseUrl}/api/v2/accounts/${id}/balances/`, {
method: "GET",
cache: "no-cache",
headers: {
"Content-Type": "application/json",
Authorization: `Bearer ${token}`,
Expand All @@ -203,6 +211,7 @@ export async function getAccounts({

const res = await fetch(`${baseUrl}/api/v2/requisitions/${accountId}/`, {
method: "GET",
cache: "no-cache",
headers: {
"Content-Type": "application/json",
Authorization: `Bearer ${token}`,
Expand Down Expand Up @@ -242,6 +251,7 @@ export async function getTransactions(accountId: string) {
const result = await fetch(
`${baseUrl}/api/v2/accounts/${accountId}/transactions/`,
{
cache: "no-cache",
method: "GET",
headers: {
"Content-Type": "application/json",
Expand All @@ -258,6 +268,7 @@ export async function getRequisitions() {

const result = await fetch(`${baseUrl}/api/v2/requisitions/`, {
method: "GET",
cache: "no-cache",
headers: {
"Content-Type": "application/json",
Authorization: `Bearer ${token}`,
Expand All @@ -272,6 +283,7 @@ export async function deleteRequisition(id: string) {

const result = await fetch(`${baseUrl}/api/v2/requisitions/${id}/`, {
method: "DELETE",
cache: "no-cache",
headers: {
"Content-Type": "application/json",
Authorization: `Bearer ${token}`,
Expand Down
2 changes: 1 addition & 1 deletion packages/jobs/src/transactions/initial.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ client.defineJob({
.insert(
transformTransactions(transactions?.booked, {
accountId: recordId, // Bank account record id
teamId: teamId,
teamId,
})
)
.select();
Expand Down
2 changes: 1 addition & 1 deletion packages/jobs/src/transactions/sync.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ client.defineJob({
}),
{
onConflict: "internal_id",
ignoreDuplicates: true,
ignoreDuplicates: false,
}
)
.select();
Expand Down
2 changes: 2 additions & 0 deletions packages/notification/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ export async function getSubscriberPreferences({
`${API_ENDPOINT}/subscribers/${teamId}_${subscriberId}/preferences`,
{
method: "GET",
cache: "no-cache",
headers: {
Authorization: `ApiKey ${process.env.NOVU_API_KEY!}`,
},
Expand Down Expand Up @@ -91,6 +92,7 @@ export async function updateSubscriberPreference({
`${API_ENDPOINT}/subscribers/${teamId}_${subscriberId}/preferences/${templateId}`,
{
method: "PATCH",
cache: "no-cache",
headers: {
Authorization: `ApiKey ${process.env.NOVU_API_KEY!}`,
"Content-Type": "application/json",
Expand Down

0 comments on commit b57ad07

Please sign in to comment.