mirror of
https://github.com/rustfs/console.git
synced 2026-09-19 09:52:25 +08:00
feat: list buckets
This commit is contained in:
@@ -14,7 +14,6 @@ export default defineNuxtPlugin((nuxtApp) => {
|
||||
console.log('[API] response', response)
|
||||
},
|
||||
async onResponseError({ response }: { response: { status: number } }) {
|
||||
console.error(response);
|
||||
if (response.status === 401) {
|
||||
token.value = undefined
|
||||
await nuxtApp.runWithContext(() => navigateTo('/auth/login'))
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
import { S3Client } from "@aws-sdk/client-s3";
|
||||
|
||||
export default defineNuxtPlugin((nuxtApp) => {
|
||||
const runtimeConfig = useRuntimeConfig().public;
|
||||
console.log('S3 runtimeConfig', runtimeConfig);
|
||||
|
||||
const client = new S3Client({
|
||||
endpoint: runtimeConfig.s3.endpoint,
|
||||
region: runtimeConfig.s3.region || 'us-east-1',
|
||||
credentials: {
|
||||
accessKeyId: runtimeConfig.s3.accessKeyId,
|
||||
secretAccessKey: runtimeConfig.s3.secretAccessKey,
|
||||
sessionToken: runtimeConfig.s3.sessionToken
|
||||
}
|
||||
});
|
||||
|
||||
// Expose to useNuxtApp().$api, useNuxtApp().$apiFetch
|
||||
return {
|
||||
provide: {
|
||||
s3Client: client
|
||||
}
|
||||
}
|
||||
})
|
||||
Reference in New Issue
Block a user