Fix deletion
This commit is contained in:
parent
a40c51eede
commit
04ad69a269
|
@ -7,7 +7,7 @@
|
|||
Modal,
|
||||
notifications,
|
||||
} from "@budibase/bbui"
|
||||
import type { OAuth2Config } from "@budibase/types"
|
||||
import type { OAuth2Config } from "@/types"
|
||||
import OAuth2ConfigModalContent from "./OAuth2ConfigModalContent.svelte"
|
||||
import { confirm } from "@/helpers"
|
||||
|
||||
|
@ -26,7 +26,7 @@
|
|||
warning: true,
|
||||
onConfirm: async () => {
|
||||
try {
|
||||
await oauth2.delete(row.id)
|
||||
await oauth2.delete(row._id, row._rev)
|
||||
notifications.success(`Config '${row.name}' deleted successfully`)
|
||||
} catch (e: any) {
|
||||
let message = "Error deleting config"
|
||||
|
|
|
@ -60,8 +60,8 @@ export class OAuth2Store extends BudiStore<OAuth2StoreState> {
|
|||
await this.fetch()
|
||||
}
|
||||
|
||||
async delete(id: string) {
|
||||
await API.oauth2.delete(id)
|
||||
async delete(id: string, rev: string) {
|
||||
await API.oauth2.delete(id, rev)
|
||||
await this.fetch()
|
||||
}
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@ export interface OAuth2Endpoints {
|
|||
update: (
|
||||
config: UpdateOAuth2ConfigRequest
|
||||
) => Promise<UpdateOAuth2ConfigResponse>
|
||||
delete: (id: string) => Promise<void>
|
||||
delete: (id: string, rev: string) => Promise<void>
|
||||
validate: (config: ValidateConfigRequest) => Promise<ValidateConfigResponse>
|
||||
}
|
||||
|
||||
|
@ -66,10 +66,11 @@ export const buildOAuth2Endpoints = (API: BaseAPIClient): OAuth2Endpoints => ({
|
|||
/**
|
||||
* Deletes an OAuth2 configuration by its id.
|
||||
* @param id the ID of the OAuth2 config
|
||||
* @param rev the rev of the OAuth2 config
|
||||
*/
|
||||
delete: async id => {
|
||||
delete: async (id, rev) => {
|
||||
return await API.delete<void, void>({
|
||||
url: `/api/oauth2/${id}`,
|
||||
url: `/api/oauth2/${id}/${rev}`,
|
||||
})
|
||||
},
|
||||
validate: async function (
|
||||
|
|
|
@ -28,7 +28,7 @@ const updateSchema = Joi.object({
|
|||
})
|
||||
|
||||
const validationSchema = Joi.object({
|
||||
_id: Joi.string().required(),
|
||||
_id: Joi.string(),
|
||||
...baseSchema,
|
||||
})
|
||||
|
||||
|
|
Loading…
Reference in New Issue