-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Daniils Petrovs
committed
Jun 23, 2024
1 parent
1d86836
commit f17b6c3
Showing
5 changed files
with
78 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import { expectedStamps } from '$lib/stores/stamps'; | ||
import { fetchStamps } from './supabase-client'; | ||
|
||
/** | ||
* Updates the expected stamps in the store by fetching stamp data from Supabase. | ||
* The fetched stamp data is transformed into an object with the hash as the key and the rest of the stamp data as the value. | ||
* The updated stamps data is then set in the expectedStamps store. | ||
*/ | ||
|
||
export async function updateExpectedStamps(): Promise<void> { | ||
console.log('Fetching stamp data...'); | ||
const stamps = await fetchStamps(); | ||
|
||
const stampsData = stamps?.reduce((acc, stamp) => { | ||
const { hash, ...rest } = stamp; | ||
acc[hash] = rest; | ||
return acc; | ||
}, {}); | ||
expectedStamps.set(stampsData || {}); | ||
} |