chore: Update checking kv namespace function to avoid failed to create namespace

This commit is contained in:
sunny
2025-03-05 13:28:45 +08:00
parent da979d2a51
commit b75d9ada43
2 changed files with 32 additions and 20 deletions

View File

@@ -96,6 +96,18 @@ export const getKVNamespace = async (namespaceId: string) => {
}
};
export const getKVNamespaceList = async () => {
try {
const kvNamespaces = await client.kv.namespaces.list({
account_id: CF_ACCOUNT_ID,
});
return kvNamespaces;
} catch (error) {
throw error;
}
}
export const createKVNamespace = async () => {
try {
console.log(`🆕 Creating new KV namespace: "${KV_NAMESPACE_NAME}"`);