-
Notifications
You must be signed in to change notification settings - Fork 60
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2428 from zetkin/undocumented/canvass-intructions
Canvass instructions
- Loading branch information
Showing
17 changed files
with
563 additions
and
3 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
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 |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import 'leaflet/dist/leaflet.css'; | ||
import { headers } from 'next/headers'; | ||
import { redirect } from 'next/navigation'; | ||
|
||
import BackendApiClient from 'core/api/client/BackendApiClient'; | ||
import { ZetkinOrganization } from 'utils/types/zetkin'; | ||
import MyCanvassAssignmentPage from 'features/canvassAssignments/components/MyCanvassAssignmentPage'; | ||
|
||
interface PageProps { | ||
params: { | ||
canvassAssId: string; | ||
}; | ||
} | ||
|
||
export default async function Page({ params }: PageProps) { | ||
const { canvassAssId } = params; | ||
const headersList = headers(); | ||
const headersEntries = headersList.entries(); | ||
const headersObject = Object.fromEntries(headersEntries); | ||
const apiClient = new BackendApiClient(headersObject); | ||
|
||
try { | ||
await apiClient.get<ZetkinOrganization>(`/api/users/me`); | ||
|
||
return <MyCanvassAssignmentPage canvassAssId={canvassAssId} />; | ||
} catch (err) { | ||
return redirect(`/login?redirect=/canvass/${canvassAssId}/map`); | ||
} | ||
} |
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
Oops, something went wrong.