diff --git a/bun.lockb b/bun.lockb index 2b906a4..48a5fe2 100755 Binary files a/bun.lockb and b/bun.lockb differ diff --git a/package.json b/package.json index a4edce7..3d63f39 100644 --- a/package.json +++ b/package.json @@ -38,7 +38,7 @@ "remark-parse": "^11.0.0", "remark-rehype": "^11.1.1", "sitemap": "^8.0.0", - "solar-js-sdk": "^0.1.1", + "solar-js-sdk": "^0.1.2", "unified": "^11.0.5", "zustand": "^5.0.3" }, diff --git a/packages/sn/package.json b/packages/sn/package.json index d845954..dca8ab9 100644 --- a/packages/sn/package.json +++ b/packages/sn/package.json @@ -8,7 +8,7 @@ "name": "LittleSheep", "email": "littlesheep.code@hotmail.com" }, - "version": "0.1.1", + "version": "0.1.2", "tsup": { "entry": [ "src/index.ts" diff --git a/packages/sn/src/network.ts b/packages/sn/src/network.ts index 970a537..d5b7bbd 100644 --- a/packages/sn/src/network.ts +++ b/packages/sn/src/network.ts @@ -15,18 +15,18 @@ function toCamelCase(obj: any): any { return obj } -// function toSnakeCase(obj: any): any { -// if (Array.isArray(obj)) { -// return obj.map(toSnakeCase) -// } else if (obj && typeof obj === 'object') { -// return Object.keys(obj).reduce((result: any, key) => { -// const snakeKey = key.replace(/[A-Z]/g, (char) => `_${char.toLowerCase()}`) -// result[snakeKey] = toSnakeCase(obj[key]) -// return result -// }, {}) -// } -// return obj -// } +function toSnakeCase(obj: any): any { + if (Array.isArray(obj)) { + return obj.map(toSnakeCase) + } else if (obj && typeof obj === 'object') { + return Object.keys(obj).reduce((result: any, key) => { + const snakeKey = key.replace(/[A-Z]/g, (char) => `_${char.toLowerCase()}`) + result[snakeKey] = toSnakeCase(obj[key]) + return result + }, {}) + } + return obj +} const baseURL = 'https://api.sn.solsynth.dev' @@ -43,6 +43,19 @@ export const sni: AxiosInstance = (() => { }, (error) => error, ) + + /// Case convertor + + inst.interceptors.request.use( + (config) => { + if (config.data) { + config.data = toSnakeCase(config.data) + } + return config + }, + (error) => Promise.reject(error), + ) + inst.interceptors.response.use( (response) => { if (response.data) { diff --git a/src/pages/console/matrix/products/[id]/releases/[release]/edit.tsx b/src/pages/console/matrix/products/[id]/releases/[release]/edit.tsx index 4e7bd98..1a5662e 100644 --- a/src/pages/console/matrix/products/[id]/releases/[release]/edit.tsx +++ b/src/pages/console/matrix/products/[id]/releases/[release]/edit.tsx @@ -12,7 +12,7 @@ export const getServerSideProps: GetServerSideProps = (async (context) => { return getConsoleStaticProps({ props: { - title: `Edit Release "${data.name}"`, + title: `Edit Release v${data.version}`, release: data, }, })