Skip to content

Commit

Permalink
Add type for allowed methods
Browse files Browse the repository at this point in the history
  • Loading branch information
srt32 committed May 29, 2024
1 parent e88543f commit 059dde3
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/auto-check-element.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@ type State = {
controller: Controller | null
}

enum AllowedHttpMethods {
GET = 'GET',
POST = 'POST',
}

const states = new WeakMap<AutoCheckElement, State>()

class AutoCheckEvent extends Event {
Expand Down Expand Up @@ -178,7 +183,7 @@ export class AutoCheckElement extends HTMLElement {
}

get httpMethod(): string {
return this.getAttribute('http-method') || 'POST'
return AllowedHttpMethods[this.getAttribute('http-method') as keyof typeof AllowedHttpMethods] || 'POST'
}
}

Expand Down

0 comments on commit 059dde3

Please sign in to comment.