-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
17 changed files
with
632 additions
and
109 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,61 @@ | ||
import { EventRequest } from "../models/dataApi"; | ||
import { EventRequest, ToggleVotingRequest, VoteRequest } from "../models/dataApi"; | ||
|
||
const url = import.meta.env.VITE_URL | ||
|
||
|
||
export async function addEvent(urlInput: string, { arg }: {arg: EventRequest} ) { | ||
export async function addEvent(urlInput: string, { arg }: { arg: EventRequest }) { | ||
|
||
const requestOptions = { | ||
method: 'POST', | ||
headers: { | ||
"Content-Type": "application/json", | ||
"Authorization": `Bearer ${localStorage.getItem('login')}` | ||
}, | ||
body: JSON.stringify(arg) | ||
}; | ||
|
||
return fetch(url + urlInput, requestOptions).then(res => res.json()) | ||
} | ||
|
||
export async function joinEvent(urlEvent: string, { arg }: { arg: string }) { | ||
|
||
const requestOptions = { | ||
method: 'PATCH', | ||
headers: { | ||
"Content-Type": "application/json", | ||
"Authorization": `Bearer ${localStorage.getItem('login')}` | ||
}, | ||
body: JSON.stringify({username: arg}) | ||
}; | ||
|
||
return fetch(url + `${urlEvent}/relationships/guests`, requestOptions).then(res => res.json()) | ||
} | ||
|
||
export async function voteOption(urlEvent: string, { arg }: { arg: VoteRequest }) { | ||
|
||
const requestOptions = { | ||
method: 'PATCH', | ||
headers: { | ||
"Content-Type": "application/json", | ||
"Authorization": `Bearer ${localStorage.getItem('login')}` | ||
}, | ||
body: JSON.stringify(arg) | ||
}; | ||
|
||
return fetch(url + `${urlEvent}/options`, requestOptions).then(res => res.json()) | ||
} | ||
|
||
|
||
export async function toggleVoting(urlEvento: string, { arg }: {arg: ToggleVotingRequest}) { | ||
|
||
const requestOptions = { | ||
method: 'PATCH', | ||
headers: { | ||
"Content-Type": "application/json", | ||
"Authorization": `Bearer ${localStorage.getItem('login')}` | ||
}, | ||
body: JSON.stringify(arg) | ||
}; | ||
|
||
return fetch(url+urlInput,requestOptions ).then(res => res.json()) | ||
} | ||
return fetch(url + `${urlEvento}/voting`, requestOptions).then(res => res.json()) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 0 additions & 10 deletions
10
web/src/components/Events/EventItem/CalendarEvent.module.css
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.