-
Notifications
You must be signed in to change notification settings - Fork 4
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
1 parent
96ba601
commit 425ab1f
Showing
8 changed files
with
33 additions
and
33 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,29 +1,29 @@ | ||
import { API_URL } from "@/lib/constants"; | ||
import router from "next/router"; | ||
|
||
export const getFavourites = async (setFavourites: any): Promise<void> => { | ||
export async function getFavourites(setFavourites: any): Promise<void> { | ||
const data: Response = await fetch(`${API_URL}/api/@me/favourites`); | ||
|
||
if (data.ok) { | ||
const JSONdata = await data.json(); | ||
setFavourites(JSONdata.favouritedTeams); | ||
} | ||
}; | ||
} | ||
|
||
export const favouriteTeam = async (data: any): Promise<void> => { | ||
export async function favouriteTeam(data: any): Promise<void> { | ||
await fetch(`${API_URL}/api/@me/favourites`, { | ||
method: "POST", | ||
body: JSON.stringify(data), | ||
}); | ||
}; | ||
} | ||
|
||
export const unfavouriteTeam = async ( | ||
export async function unfavouriteTeam( | ||
favouritedTeam: any, | ||
noReload?: boolean | ||
): Promise<void> => { | ||
): Promise<void> { | ||
await fetch(`${API_URL}/api/@me/favourites?id=${favouritedTeam[0].id}`, { | ||
method: "DELETE", | ||
}); | ||
|
||
if (!noReload) await router.push(router.pathname); | ||
}; | ||
} |
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,11 +1,11 @@ | ||
import chalk from "chalk"; | ||
|
||
export const log = (type: string, text: string): void => { | ||
export function log(type: string, text: string): void { | ||
switch (type) { | ||
case "warning": | ||
return console.log(`${chalk.yellow("INFO:")} ${text}`); | ||
|
||
case "error": | ||
return console.log(`${chalk.red("ERROR")} ${text}`); | ||
} | ||
}; | ||
} |
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
425ab1f
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
web – ./
scoutmachine.vercel.app
web-scoutmachine.vercel.app
web-git-staging-scoutmachine.vercel.app
machine.frc6070.ca